Граф коммитов

13050 Коммитов

Автор SHA1 Сообщение Дата
Harrison Healey
2ebc8ec90f MM-20897 Add category muting (#16225)
* Make UpdateSidebarCategories return the original categories

* MM-20897 Add category muting

* Prevent muting the DMs category

* Fix muted state not being stored in the database

* Address feedback

* Address some feedback

* Fix unit tests

* MM-20897 Mute/unmute channels in the database in bulk

* Satisfy golangci-lint
2020-11-16 15:19:01 -05:00
Elisabeth Kulzer
7f6b43a15f DOPS-243 (#16279)
DOPS-243 (#16279)
2020-11-16 17:22:30 +01:00
Mario de Frutos Dieguez
58d362e0c8 Include cloud defaults in the EE release package (#16277)
That defaults file would be used in the cloud installations to set the
initial values for them
2020-11-16 16:52:26 +01:00
Miguel de la Cruz
6c857a4525 [MM-30436] Add support for configuration custom defaults (#16265)
* [MM-30436] Add support for configuration custom defaults

* Addressing review comments

* Addressing PR comments

* Soft fail if the configuration defaults cannot be read

* Directly print error in log message

* Fix linter

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-11-16 15:25:48 +01:00
Agniva De Sarker
c82c37a36e MM-28067: Optimize app server startup in tests (#16263)
* MM-28067: Optimize app server startup in tests

For every test, we would wipe out the database and then start
the server again. This would run through all the migrations
and create new rows in Systems and Roles table every time.
As a result, this was consuming a lot of setup time for every test.

We optimize this by preloading the DB with dummy data in the roles
and systems table so that the server code just skips over those migrations.
This is completely forward compatible and adding new migrations does not
need to generate the sql files again. Only in case of schema changes to the
roles or systems table, this would need to be done.

It is unlikely the Systems table schema will get changed. The Roles table
might change in future but it's a comparatively rare event. Given the reduction
in CI runtime we are seeing, it's a worthy optimization.

We also apply some more optimizations:
- Coalesce multiple UpdateConfig calls into a single one. Each UpdateConfig call
has to do a json marshal which would take precious CPU cycles. It's much more
efficient to do everything in a single call.
- Remove unnecessary debug.FreeOSMemory in reload config. This was an artifact
from old days and is no longer required.

Numbers:
Results show a full **2 minutes** shaved off the test runtime. Earlier, tests
would take around 16 minutes. Now they take 14 minutes.

```release-note
NONE
```

* fix app package
2020-11-16 13:55:32 +01:00
Dexter Chua
e162c6c787 Indicate deleteBy in post_deleted websocket event (#15332)
This lets the client know who deleted the post. This information is
stored in the database, but cannot be retrieved from an API endpoint
because the API does not return information about deleted post.

Currently, the information is only sent to system administrators.
2020-11-16 11:56:29 +01:00
Doug Lauder
277f886b3f MM-30212 Support dynamic autocomplete for built-in slash commands (#16196)
Support added for dynamic auto-completion lists for built-in slash commands.

* a moniker within the fetch url determines whether the request should be sent via HTTP(S) or routed internally to a built-in command. The moniker is of the form builtin: followed by the name of the built-in command to use. e.g. builtin:share would be become a call to the share command to fetch auto-completion items.

* command providers implement the optional DynamicListProvider interface to indicate they can provide dynamic auto-completion.
2020-11-13 21:10:07 -05:00
Ibrahim Serdar Acikgoz
46a409aef6 app/server_test: make sure sentry is ready to be setup (#16260) 2020-11-13 19:10:10 +03:00
Farhan Munshi
c9a4a475d3 [MM-28717] Refactor applyMultiRoleFilters to use sq builder (#15500)
* Refactor apply multi role filters and add role filters to get all profiles

* Add some tests

* Fix tests

* Fix lint

* Trigger CI

* Rename param to make more sense

* Tie get filtered user stats to usermanagement read users

* Dont filter out other system roles when searching for team members or team admins only filter out system admins

* add new permissions

* add migration

* fix test

* remove system roles as default permissions

* implement changes discussed with dennis

* add read only and fix i18n

* use model consts instead of strings

* turn the permissions into pseudo constants

* Update read only default permissions

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Hossein Ahmadian-Yazdi <hyazdi1997@gmail.com>
2020-11-13 10:57:57 -05:00
Nick Misasi
1d15900f84 [MM-29999] User Limit Email Notifications (Part 2) (#16220)
* Adding files commiting to do something else

* Stashing to merge master

* Adding files, commit of working code, pre-test

* Changing up logic according to new conversations, adding template and functions for 7 day and 14 day emails

* Add subscription active check

* Add a comment around subscription status

* Fix i18n

* Update jobs/cloud/worker.go

Co-authored-by: Maria A Nunez <maria.nunez@mattermost.com>

* Add a check for cloud license and exit early

* remove log

* Update jobs/cloud/worker.go

Co-authored-by: Maria A Nunez <maria.nunez@mattermost.com>

* Remove case for 91st day

* Change var name

* Fix i18n

* Change value for dates in email

* Add email template and send logic for support email on 30th day of arrears

* Fix EETests?

* add one to the day so the count starts on first day of next cycle

* use the license for the enabled check

* Moved scheduler and worker into enterprise

* Add the user count to the support email

* remove a line

* Use the date for the 14 day email

* Fix for design review

* More font changes

* Fixes for PR

* Change feature flag name

* Add cloud_interface to einterfaces/jobs

* Add back & for running job server

* Remove unused constant

Co-authored-by: Maria A Nunez <maria.nunez@mattermost.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-11-12 09:07:31 -05:00
Agniva De Sarker
cae59d327c MM-29486: Fix racy test TestPatchChannelModeration (#16256)
* MM-29486: Fix racy test TestPatchChannelModeration

- We avoid appending to the slice in `(r *Role) IsValidWithoutId`
by just iterating the 2 slices separately.
- We pass deep copies of channels to prevent racy modification.

https://mattermost.atlassian.net/browse/MM-29486

```release-note
NONE
```

* fix lint

* simplify perm check

* improve more

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-11-12 15:26:35 +05:30
Agniva De Sarker
42c785218d MM-29488: Fix racy test TestScheduler (#16257)
* MM-29488: Fix racy test TestScheduler

We iterate the nextRunTimes slice only after stopping the
scheduler.

And since we are checking the slice 3 times, we split
the test into 3 sub-tests, every time starting a new scheduler
and running the same steps again.

https://mattermost.atlassian.net/browse/MM-29488

```release-note
NONE
```

* incorporate review comments

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-11-12 09:39:19 +05:30
cpanato
0f4c6bc074 fix git commit hash to use in the docker image 2020-11-11 19:27:45 +01:00
Agniva De Sarker
87a5510adc MM-29479: Fix racy test TestSidebarCategory (#16255)
Automatic Merge
2020-11-11 12:49:56 -05:00
cpanato
3782b3e21b fix docker push 2020-11-11 18:25:53 +01:00
cpanato
37e8fe8e33 fix build branch pipeline 2020-11-11 17:42:07 +01:00
Carlos Tadeu Panato Junior
2c08ff1299 build: push git commit hash as tags as well (#16261) 2020-11-11 17:11:48 +01:00
John Tzikas
ab50fa155b Remove unused argument on runServer (#16237) 2020-11-11 10:09:30 -04:00
Weblate (bot)
9a62395087 Translations update from Weblate (#16246)
* Translated using Weblate (Portuguese (Brazil))

Currently translated at 97.2% (2006 of 2063 strings)

Translation: mattermost-languages-shipped/mattermost-server_master
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-server_master/pt_BR/

* Translated using Weblate (Japanese)

Currently translated at 98.9% (2042 of 2063 strings)

Translation: mattermost-languages-shipped/mattermost-server_master
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-server_master/ja/

Translated using Weblate (Japanese)

Currently translated at 97.8% (2018 of 2063 strings)

Translation: mattermost-languages-shipped/mattermost-server_master
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-server_master/ja/

Co-authored-by: rodrigocorsi <rodrigocorsi@gmail.com>
Co-authored-by: kaakaa <stooner.hoe@gmail.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-11-10 09:34:26 +01:00
Agniva De Sarker
0ca8cb36b4 MM-26425: Make URL parsing for image proxy more robust (#16197)
* MM-26425: Make URL parsing for image proxy more robust

- We don't bypass protocol relative URLs.
- We don't bypass hostnames with a similar prefix.

https: //mattermost.atlassian.net/browse/MM-26425

```release-note
NONE
```

* fix tests and incorporate review comments

* Handle opaque URLs

* Fix path tests

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-11-10 13:06:59 +05:30
Agniva De Sarker
39b5b601f8 MM-30026: Use DB master when getting team members from a session (#16170)
* MM-30026: Use DB master when getting team members from a session

A race condition happens when the read-replica isn't updated yet
by the time a session expiry message reaches another node in the cluster.

Here is the sequence of events that can cause it:
- Server1 gets any request which has to wipe session cache.

- The SQL query is written to DB master, and a cluster message is propagated
to clear the session cache for that user.

- Now before the read-replica is updated with the master’s update,
the cluster message reaches Server2. The session cache is wiped out for that user.

- _Any random_ request for that user hits Server2. Does NOT have to be
the update team name request. The request does not find the value
in session cache, because it’s wiped off, and picks it up from the DB.
Surprise surprise, it gets the stale value. Sticks it into the cache.

By now, the read-replica is updated. But guess what, we aren’t going to
ask the DB anymore, because we have it in the cache. And the cache has the stale value.

We use a temporary approach for now by introducing a context in the DB calls so that
the useMaster information can be easily passed. And this has the added advantage of
reusing the same context for future DB calls in case it happens. And we can also
add more context keys as needed.

A proper approach needs some architectural changes. See the issue for more details.

```release-note
Fixed a bug where a session will hold on to a cached value
in an HA setup with read-replicas configured.
```

* incorporate review comments

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-11-10 10:43:45 +05:30
Agniva De Sarker
6c71fbaebd MM-29478: Fix race in TestNotifyClusterEvent (#16240)
The messages slice was accessed in a race manner. We protect it
with a mutex

```release-note
NONE
```

https://mattermost.atlassian.net/browse/MM-29478
2020-11-09 19:25:51 +05:30
rishabh710
ce28d41aef Update README.md (#16224)
addition of contributing section
2020-11-09 11:49:04 +01:00
John Tzikas
ed3ad65756 Fix misspelled function name (#16236) 2020-11-09 11:32:21 +01:00
Eli Yukelzon
45e340b5be MM-29987 Implement new collapsed threads API (#16091) 2020-11-08 10:36:46 +02:00
Joram Wilander
483441cea2 Soft fail on cloud user limit warnings when creating user (#16230) 2020-11-07 11:39:32 -05:00
Scott Bishel
3b580c03e9 MM-29223-Retrieve Compliance (#15825)
* Revert EN JSON stuff

* updat en.json

* Update en.json

* add unit test, update download for filename

* update to use filepath.Join

* linter errors

Co-authored-by: Hossein Ahmadian-Yazdi <hyazdi1997@gmail.com>
Co-authored-by: Hossein Ahmadian-Yazdi <hahmadia@users.noreply.github.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-11-06 17:56:56 -07:00
Harrison Healey
dc030bebbf MM-30090 Add telemetry for ManagedResourcePaths (#16221) 2020-11-06 08:32:37 -05:00
Jesús Espino
b08b51d52d MM-30300: Add coalesce to get null content as empty string on FileInfo store (#16216)
* MM-30300: Add coalesce to get null content as empty string on FileInfo store

* Making explicit the fields get from the FileInfo table

* Addressing PR review comments
2020-11-06 12:49:15 +01:00
Miguel de la Cruz
d2ec53f1e9 Local mode migration for webhook endpoints (#16094)
* Migrate update/list/show webhook endpoints to local mode

* Fix shadow errors

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-11-06 11:09:41 +01:00
Harrison Healey
059672ba73 MM-30090 Add ManagedResourcePaths setting (#16213) 2020-11-05 11:07:03 -05:00
Choo Jia Le
ccf5916ef0 [MM-24337]: Fix the team and channel filtering UT to include empty team or channel (#15912)
* Fix the team and channel filtering UT to include empty team or channel

* Fix tests that were failing before this change

Once we've activated the team/channels filter tests for PostgreSQL
and MySQL there are some tests failing so this changes fixes them

* Disable team filtering tests for DBs by now

We have a discrepancy between DB search and ES/Bleve on how to filter
teams when you have users in both teams:

  - DB when filtering by one team and searching by another returns users that are in both teams
  - Bleve and ES returns empty

Co-authored-by: Mario de Frutos <mario@defrutos.org>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-11-05 12:45:41 +01:00
Eli Yukelzon
997e77f495 flaky test fix related to product notices (#16209) 2020-11-04 11:41:42 +02:00
Ikko Ashimine
122acc3dd7 Fix typo in comment (#16208)
enviroment -> environment
2020-11-04 10:14:08 +01:00
sowmiyamuthuraman
5a6d8387f5 MM-29379 Ignore channel mentions when channel is muted and channel mention setting is not updated by the user (#15992) 2020-11-04 10:13:24 +01:00
Agniva De Sarker
66731e2740 MM-29980: Optimize profilesInChannels cache to fast path (#16116)
* MM-29980: Optimize profilesInChannels cache to fast path

We add one more message type to the fast path- profiles in channels. There
are 2 primary reasons for this:

- This is not really a new model type, but just a map of users. And users already use
the fast path. So we can get some more gains without really investing much more code.
- A more important reason is that with the upcoming striped mutex changes, we will get
a higher throughput at the cost of a bit more CPU utilization. The reason being that
since less amount of time will be spent in lock-contention, the CPU is free to do more
stuff. So this change is to counter that increase.

As usual, this gives much better performance than the original decoder.

Micro-benchmark results
```
name               old time/op    new time/op    delta
LRU/UserMap=new-8    16.6µs ± 3%     3.9µs ± 4%  -76.15%  (p=0.000 n=10+10)

name               old alloc/op   new alloc/op   delta
LRU/UserMap=new-8    4.78kB ± 0%    2.74kB ± 0%  -42.65%  (p=0.000 n=10+10)

name               old allocs/op  new allocs/op  delta
LRU/UserMap=new-8      38.0 ± 0%      30.0 ± 0%  -21.05%  (p=0.000 n=10+10)
```

https://mattermost.atlassian.net/browse/MM-29980

Here are some results from a load test. The comparison is done with a 2 node cluster; one running master
and one running with this patch so that it's easier to compare. The total users are 2000.

<See PR>

```release-note
NONE
```

* Fix gofmt

* Trigger CI
2020-11-04 10:08:10 +05:30
Agniva De Sarker
4758408699 MM-29979: make websocket writes zero-alloc (#16115)
This reverts commit 31dac80e66.
2020-11-04 10:05:10 +05:30
Kaiwalya Koparkar
fb9c2faa1a License Agreement and Documentation added (#16048)
Automatic Merge
2020-11-03 14:37:37 -05:00
Nick Misasi
714435fc4c Pass the filename from CWS on to the client (#16203) 2020-11-03 13:11:18 -05:00
Ikko Ashimine
bec4e361a9 Fix typo in comment (#16198)
occuring -> occurring
2020-11-03 13:14:21 +01:00
Weblate (bot)
b3e8b009a5 Translations update from Weblate (#16193)
* Translated using Weblate (Dutch)

Currently translated at 99.7% (2058 of 2063 strings)

Translation: mattermost-languages-shipped/mattermost-server_master
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-server_master/nl/

Translated using Weblate (Dutch)

Currently translated at 98.0% (2020 of 2061 strings)

Translation: mattermost-languages-shipped/mattermost-server_master
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-server_master/nl/

* Translated using Weblate (Turkish)

Currently translated at 100.0% (2063 of 2063 strings)

Translation: mattermost-languages-shipped/mattermost-server_master
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-server_master/tr/

Co-authored-by: Tom De Moor <tom@controlaltdieliet.be>
Co-authored-by: Kaya Zeren <kayazeren@gmail.com>
2020-11-02 21:43:32 +01:00
Jesús Espino
24621a22ed Add the content field to FileInfo (#15749)
* Add the content field to FileInfo

* Fixing the upgrade code

* Trying to fix the text-scheme

* Fixing test-schema

* Fixing test-schema

* Moving the migration to the next version
2020-11-02 15:43:48 +01:00
Ibrahim Serdar Acikgoz
9bff309dd0 storetest/team_store: fix flaky test for searching a short term (#16172)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-10-31 12:13:28 +03:00
Jared Shields
3515b4d6c9 GH-15624: Added plugin hooks for ReationHasBeenAdded and ReactionHasBeenRemoved (#15765) 2020-10-31 07:06:43 +01:00
Ibrahim Serdar Acikgoz
71c371509b storetest/user_store: fix flaky test (#16095) 2020-10-30 20:09:28 +03:00
Eli Yukelzon
fe352ab57f MM-29703 Mark threads as read when channels are marked (#15994)
Co-authored-by: Jesús Espino <jespinog@gmail.com>
2020-10-30 17:00:21 +02:00
Carlos Tadeu Panato Junior
1729239385 upgrade DB to 5.29 (#16081) 2020-10-30 13:37:26 +01:00
Agniva De Sarker
325bff1176 MM-30041: Return correct error message for user save (#16117)
* MM-30041: Return correct error message for user save

We were collapsing all types of user conflict into a single
error message. Fixed it by inspecting the field of the invalidError type
and returning the correct message.

https://mattermost.atlassian.net/browse/MM-30041

```release-note
NONE
```

* Fix test errors

* Fix wrong message in test when comparing error messages

Co-authored-by: Rodrigo Villablanca <villa061004@gmail.com>
2020-10-30 11:14:06 +05:30
Christopher Speller
1aadd36644 MM-28859 Add feature flag managment system using split.io and remove viper. (#15954)
* Add feature flag managment system using split.io and remove viper.

* Fixing tests.

* Attempt to fix postgres tests.

* Fix watch filepath for advanced logging.

* Review fixes.

* Some error wrapping.

* Remove unessisary store interface.

* Desanitize SplitKey

* Simplify.

* Review feedback.

* Rename split mlog adatper to split logger.

* fsInner

* Style.

* Restore oldcfg test.

* Downgrading non-actionable feature flag errors to warnings.

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-10-29 15:54:39 -07:00
Harrison Healey
8bb772638c MM-29067 Add deterministic IDs for default sidebar categories (#16030)
Automatic Merge
2020-10-29 10:24:01 -04:00