Commit Graph

9772 Commits

Author SHA1 Message Date
Jesse Hallam
0affad9c24 fix user timezone initialization (#8547)
On PreSave, need to ensure TimeZone isn't left as NULL.
2018-03-29 14:58:18 -04:00
Jesús Espino
014a3b6a60 Fixing misspell errors (#8544) 2018-03-29 10:04:54 -04:00
Chris Duarte
eb48292a3a Add ExperimentalTimezone flag (#8539) 2018-03-29 10:04:17 -04:00
Jesse Hallam
d4c0494360 MM-9661: tweak post message size log (#8517)
Call out the number of supported characters explicitly, moving the byte
limit to parentheses.
2018-03-29 10:02:58 -04:00
Christopher Speller
26b523e4a1 Revert "add individual platform packaging targets (#8366)" (#8537)
This reverts commit f0f4f68def.
2018-03-28 14:54:58 -07:00
Jesse Hallam
9c9a9ade12 Remove the index on Channels.DisplayName. (#8530)
As outlined in [this
discussion](https://pre-release.mattermost.com/core/pl/uw5bwmkb6irkbkn6pk9rkzpytr),
this index causes issues with MySQL's query planner, leading to full
table scans in a case where it would have made more sense to leverage a
filesort.
2018-03-28 09:22:55 -07:00
Jesse Hallam
1ccad749f1 Add unit test coverage for SqlStatusStore.GetAllFromTeam (#8520)
I added this as part of a separate PR that was deferred for now, but
figured the unit test coverage would still be useful.
2018-03-28 09:20:39 -07:00
Joram Wilander
3394a51dc6 Add defaults for SAML settings (#8536) 2018-03-28 11:24:13 -04:00
Jason Blais
5151a92f91 Add SAML scoping IDP settings to diagnostics.go (#8531) 2018-03-28 12:54:44 +01:00
George Goldberg
a28f6e7748 Fix roles table ID max length so MySQL 5.6 doesn't fail. (#8532) 2018-03-28 09:58:00 +01:00
Elias Nahum
ad8bf48c4e translations PR 20180326 (#8514) 2018-03-28 10:08:07 +03:00
Christian Claus
257f748732 [PLT-4340] Channel Mute and "/mute" command #7617 (#7713)
* Add command and store changes to allow mute toggling

* Change channel muting to use ChannelMember notification structure

* Suppress email and push notifications for a muted channel

* Make i18n keys issue-compliant

* Add notification-cache handling for channel-muting

* Add channel handle for channel-muting slash-command

* Add unit test for mute command

* Merge branch 'master' into PLT-4340

# Conflicts:
#	app/notification.go

* Fix issue that command_mute responses will be overwritten

* Fix i18n key for channel muting

* Apply new Provider Interface to MuteCommand

* Migrate mute notification property to mark_unread

PLT-4340

* Make some i18n improvements for command_mute

PLT-4340

* Remove de.json translations

* Prevent push notifications when channel is muted

* Treat Group messages like Direct messages

* Fix unit test

* Send WS event when the channel member notify props changed
2018-03-28 07:02:04 +03:00
George Goldberg
71c9dff766 Merge branch 'advanced-permissions-phase-1' 2018-03-27 22:36:55 +01:00
Jesse Hallam
2af4c7e649 fix typo in the pull request template (#8521) 2018-03-27 15:18:57 -04:00
amyblais
e40b7f6b31 Update NOTICE.txt (#8523) 2018-03-27 15:18:28 -04:00
Saturnino Abril
07b14c370a post a system message after a channel is converted from public to private (#8501) 2018-03-27 21:14:42 +08:00
Martin Kraft
e13e64711f Merge remote-tracking branch 'origin/master' into advanced-permissions-phase-1 2018-03-27 09:01:42 -04:00
George Goldberg
d8b4207018 Fix typo in MANAGE_SYSTEM_WIDE_OAUTH permission. (#8516) 2018-03-27 13:42:44 +01:00
Jesús Espino
9e6db178b0 Adding durafmt library and use it from enterprise global relay export (#8487)
* Adding durafmt library and use it from enterprise global relay export

* Allow to specify different server host and server name on smtp connections

* Fixing utils/smtp tests
2018-03-27 10:23:33 +02:00
Jesse Hallam
8491ba5740 Relax 4k post message limit (#8478)
* MM-9661: rename POST_MESSAGE_MAX_RUNES to \0_v1

* MM-9661: s/4000/POST_MESSAGE_MAX_RUNES_V1/ in tests

* MM-9661: introduce POST_MESSAGE_MAX_RUNES_V2

* MM-9661: migrate Postgres Posts.Message column to TEXT from VARCHAR(4000)

This is safe to do in a production instance since the underyling type is
not changing. We explicitly don't do this automatically for MySQL, but
also don't need to since the ORM would have already created a TEXT column
for MySQL in that case.

* MM-9661: emit MaxPostSize in client config

This value remains unconfigurable at this time, but exposes the current
limit to the client. The limit remains at 4k in this commit.

* MM-9661: introduce and use SqlPostStore.GetMaxPostSize

Enforce a byte limitation in the database, and use 1/4 of that value as
the rune count limitation (assuming a worst case UTF-8 representation).

* move maxPostSizeCached, lastPostsCache and lastPostTimeCache out of the global context and onto the SqlPostStore

* address feedback from code review:

* ensure sqlstore unit tests are actually being run
* move global caches into SqlPostStore
* leverage sync.Once to address a race condition

* modify upgrade semantics to match new db semantics

gorp's behaviour on creating columns with a maximum length on Postgres
differs from MySQL:
* Postgres
  * gorp uses TEXT for string columns without a maximum length
  * gorp uses VARCHAR(N) for string columns with a maximum length of N
* MySQL
  * gorp uses TEXT for string columns with a maximum length >= 256
  * gorp uses VARCHAR(N) for string columns with a maximum length of N
  * gorp defaults to a maximum length of 255, implying VARCHAR(255)

So the Message column has been TEXT on MySQL but VARCHAR(4000) on
Postgres. With the new, longer limits of 65535, and without changes to
gorp, the expected behaviour is TEXT on MySQL and VARCHAR(65535) on
Postgres. This commit makes the upgrade semantics match the new database
semantics.

Ideally, we'd revisit the gorp behaviour at a later time.

* allow TestMaxPostSize test cases to actually run in parallel

* default maxPostSizeCached to POST_MESSAGE_MAX_RUNES_V1 in case the once initializer panics

* fix casting error

* MM-9661: skip the schema migration for Postgres

It turns out resizing VARCHAR requires a rewrite in some versions of
Postgres, but migrating VARCHAR to TEXT does not. Given the increasing
complexity, let's defer the migration to the enduser instead.
2018-03-26 17:55:35 -04:00
Christopher Speller
4a69c277a6 Adding go client support and basic unit tests for channel autocomplete. (#8510) 2018-03-26 12:41:06 -07:00
George Goldberg
ca5198c7b6 Ignore blank role names in getRolesByName call. (#8507) 2018-03-26 13:56:57 +02:00
Chris
2bf2b5b851 send websocket event when users are activated / deactivated (#8500) 2018-03-23 15:04:22 -05:00
Jesús Espino
a8e0fc6c5d Changing the user-0 data to sysadmin and user-1 username to user-1 (#8494) 2018-03-23 15:32:10 -04:00
Jesse Hallam
1351874528 improve error handling around invalid Forward80To443 settings (#8496)
* If Forward80To443 is true, but not configured to listen on 443, fail to start the server with an error message.
* If Forward80To443 is false and LetsEncrypt is true, fail to start the server with an error message.
2018-03-23 09:33:50 -07:00
Elias Nahum
67c0efae1b Allow to get the team icon for open teams (#8499)
* Allow to get the team icon for open teams

* feedback review
2018-03-23 16:49:18 +03:00
Fede
6094778e69 [MM-9777] Avoids adding custom emojis with the same name as a system emoji (#8461)
* Emoji validation fails if name exists in system emojis

* Use hashmap instead of array to improve performance

* Changed utils/StringInMap to emoji/isSystemEmoji

* Load system emojis from model/emoji.json

* Added emoji.json from webapp

* Load system emojis from emoji_data.go instead of emoji.json

* Run `gofmt -w model/emoji_data.go`
2018-03-23 09:11:43 -04:00
Martin Kraft
5fa1b35819 Merge branch 'master' into advanced-permissions-phase-1 2018-03-23 09:08:49 -04:00
Jesse Hallam
87762ae62e Improved bulkload error handling (#8491)
* log the config file path used by the server on startup

* return an err if the bulk import command fails

* log the underlying errors that occur when importing

The code assumed all errors meant a missing resource, but it's possible
something else is at fault. Including the error helps pinpoint that more
readily.
2018-03-23 03:33:02 +08:00
Elias Nahum
c9e9484150 MM-9853 Fix Team invite does not carry through SAML login (#8495) 2018-03-22 19:46:30 +02:00
Jesse Hallam
6036ddad85 MM-9804: emit defaults for all enterprise config (#8490)
* MM-9804: emit defaults for all enterprise config

This prevents the client from having to write inverted checks if a
certain value defaults as `'true'` instead of `'false'`.

* move EnableMobileFile(Upload|Download) to a defaulted enterprise configuration
2018-03-22 07:57:29 -07:00
Chris Duarte
74e703f58d Timezone feature (#8185)
* Add supported timezones into config

Remove Timezone list creation in favor of timezone from configs

Add Timezone field to Users table

Clean up format of SupportedTimezones in config

* Remove unwanted change

* Add test for updating user timezone

* Add empty map[string]string if Timezone is null

* Add EnableTimezoneSelection config

* Revert back to map[string]string for ClientConfig

* Refactor SupportedTimezones into timezones.json

* Include timezones.json in TestConfigFlag

* Add timezone api endpoint

* Bump varchar size to 256 and setMaxSize in user_store

* Refactor LoadConfig to LoadConfig and LoadTimezoneConfig

* Remove unnecessary argument in LoadConfig, mail_test

* Add test for timezone endpoint

* Add license header

* Refactor timezones endpoint to system.go

* Add system base route to timezone endpoint

* db timezone upgrade in db v4.9

* Avoid saving SupportedTimezones to config.json

* Add timezonePath support in config

* Remove EnableTimezoneSelection from config

* Use return statement without return parameter

* Refactor test for SupportedTimezones

* Check for supportedTimezone != nil instead of using len

* Decouple SupportedTimezones out of Config

* Fix failing test

* Add LastTeamIconUpdate back in upgrade.go

* Write timezone config in config_flag_test

* Add code fallback for default timezone support
2018-03-22 09:53:43 -04:00
Jesse Hallam
9d701c7044 Fix various segfaults when running go test manually (#8448)
* failing to find i18n shouldn't segfault

The server was trying to handle the fact that it couldn't find the i18n
directory, by emitting a translated log message...

* fix utils.FindDir

The attempts to find the directory in the parent or grandparent directory
don't work if the current working directory was inside `enterprise`, with
`enterprise` itself being a symlink as per the usual developer setup.

Recurse to the root of the filesystem, cleaning the path along the way
to work around this limitation (and allow tests to be run from an
arbitrarily deep nesting level.)

Fix corresponding usages to employ filepath.Join.

* failing to find html templates shouldn't segfault

* fail fast if the test user cannot be created

* rework utils.FindDir to retain backwards compatibility
2018-03-21 18:27:14 +00:00
Joram Wilander
b1b23079c6 Fix paging for GET /teams and GET /teams/{id}/members endpoints (#8488) 2018-03-21 23:33:47 +08:00
Jesús Espino
b4784be2de Receive the email date as parameter (#8484) 2018-03-21 16:11:45 +01:00
Harrison Healey
6ef6c69968 Fixed missing error in log message (#8485) 2018-03-21 09:13:20 -04:00
Jason Blais
b118451f3d Update plugin.go (#8486) 2018-03-21 09:11:51 -04:00
Chris
7e444dfd88 add config for saml home realm discovery bypass (#8480) 2018-03-20 13:19:34 -05:00
Elias Nahum
6e4c9b1db2 translations PR 20180319 (#8479) 2018-03-20 18:55:26 +08:00
George Goldberg
37f0e5e0eb Merge branch 'master' into advanced-permissions-phase-1 2018-03-19 10:53:37 +00:00
Jesse Hallam
4b675b347b MM-9770: rewrite getParentsPosts to improve performance (#8467)
* rename variables in testPostStoreGetPostsWithDetails

This helps to clarify the structure of the posts under test.

* clarify and expand existing testPostStoreGetPostsWithDetails assertions

* expand testPostStoreGetPostsWithDetails assertions

This verifies that replies to posts in the window, themselves not in the
window (because of a non-zero offset) are still fetched. They were
previously missing.

* MM-9770: rewrite getParentsPosts to improve performance

See discussion on ~developers-performance, but the basic idea here is to
force the database to use the `PRIMARY` index when fetching posts
instead of trying to filter down by channel and doing a scan.
2018-03-16 08:10:14 -07:00
Derrick Anderson
a41a9500bc Merge branch 't0merge48master' 2018-03-15 15:34:57 -04:00
Derrick Anderson
accf612d25 Merge remote-tracking branch 'origin/release-4.8' into t0merge48master 2018-03-15 14:30:57 -04:00
Jesús Espino
e3edc2c121 Isolating configuration, sending emails and connection to SMTP. (#8452)
* Isolating configuration, sending emails and connection to SMTP.

* Building smtpAddress once

* Remove unnecesary errX variables

* Moving mail connection information to new data structure
2018-03-15 19:07:47 +01:00
Carlos Tadeu Panato Junior
bf2038bc41 [MM-9703] Push notifications are sent for own DM's (#8439)
update
2018-03-15 10:42:49 -04:00
Joram Wilander
d1ed79a66c Add content type to API error response (#8460) v4.8.0 v4.8.0-rc6 v4.8.0-rc5 2018-03-14 18:09:04 -04:00
Elias Nahum
ddc6d49d80 translations PR 20180314 (#8458) 2018-03-14 14:30:54 -04:00
Derrick Anderson
6830627faa Merge branch 't2releasetomaster' 2018-03-13 18:02:48 -04:00
Derrick Anderson
690cbc4903 Merge remote-tracking branch 'origin/release-4.8' into t2releasetomaster 2018-03-13 17:14:05 -04:00
Michał Odziemczyk
88b9d2225d MM-9795: Fix theme chooser for non-EE builds (#8440)
* Fix theme chooser for non-EE builds

* fix compilation

* remove whitespace

* fix
v4.8.0-rc4
2018-03-13 13:21:02 -04:00