Commit Graph

12617 Commits

Author SHA1 Message Date
Rodrigo Villablanca
8b6a5fc5d7 TokenStore migration to return plain errors (#14875)
* TokenStore migration to return plain errors

* Fix translations

* Fix: returned error is ignored and http.StatusBadRequest is always returned

* Fix

* Fix translations

* Suggestions

* Changed from BadRequest to NotFound

* Setting the correct http status

* Changed test to expect 404 status

* Fix error
2020-07-09 12:46:27 +05:30
Mario de Frutos Dieguez
4df6019f61 [MM-24089] Remove use of Gorp in ChannelStore.GetAllChannelMembersForUser (#14663)
* Remove use of Gorp in ChannelStore.GetAllChannelMembersForUser

In order to improve performance, we're removing gorp calls in the
most used queries in the platform and this is one of them
2020-07-09 09:13:17 +02:00
Harrison Healey
7910e237b9 MM-26793 Fix accidentally removing other users' favorites (#14988) 2020-07-08 15:30:20 -04:00
Harrison Healey
302e59a0fe MM-26753 Create initial sidebar categories on demand if migration hasn't ran (#14981)
* MM-26753 Change CreateInitialSidebarCategories to only take a user ID

* MM-26753 Create initial sidebar categories on demand if migration hasn't ran

* Wait for sidebar categories to be loaded in case of replication lag
2020-07-08 12:07:42 -04:00
Farhan Munshi
31200fc657 [MM-26541] Parse channel member counts using LIKE instead of using JSON (#14941)
* MM-26541 parse channel member counts using like instead of using JSON as mysql versions do not support json extract

* Use a constant for default timezone

* Update wording and comments

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-07-08 10:56:47 -04:00
Ashish Bhate
eabae5437b MM-26015: ensure admin retains permissions to team after being removed from a team (#14961)
Summary:
Ensure admin retains permissions to team after being removed from a team

Ticket Link:
https://mattermost.atlassian.net/browse/MM-26015
2020-07-08 16:59:16 +05:30
Weblate (bot)
87be9bc2f5 Translations update from Weblate (#14872)
* Translated using Weblate (Malayalam)

Currently translated at 5.1% (103 of 1982 strings)

Translation: mattermost/mattermost-server_master
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-server_master/ml/

Translated using Weblate (Malayalam)

Currently translated at 5.2% (105 of 1982 strings)

Translation: mattermost/mattermost-server_master
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-server_master/ml/

Added translation using Weblate (Malayalam)

* Translated using Weblate (Dutch)

Currently translated at 81.7% (1621 of 1982 strings)

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

Translated using Weblate (Dutch)

Currently translated at 81.7% (1621 of 1982 strings)

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

Translated using Weblate (Dutch)

Currently translated at 81.7% (1620 of 1982 strings)

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

* Translated using Weblate (Turkish)

Currently translated at 100.0% (1974 of 1974 strings)

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

Translated using Weblate (Turkish)

Currently translated at 100.0% (1973 of 1973 strings)

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

Translated using Weblate (Turkish)

Currently translated at 100.0% (1972 of 1972 strings)

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

Translated using Weblate (Turkish)

Currently translated at 100.0% (1976 of 1976 strings)

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

Translated using Weblate (Turkish)

Currently translated at 100.0% (1975 of 1975 strings)

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

Translated using Weblate (Turkish)

Currently translated at 100.0% (1972 of 1972 strings)

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

Translated using Weblate (Turkish)

Currently translated at 100.0% (1982 of 1982 strings)

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

Translated using Weblate (Turkish)

Currently translated at 100.0% (1982 of 1982 strings)

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

Translated using Weblate (Turkish)

Currently translated at 100.0% (1982 of 1982 strings)

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

* Translated using Weblate (Chinese (Simplified))

Currently translated at 96.7% (1918 of 1982 strings)

Translation: mattermost/mattermost-server_master
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-server_master/zh_Hans/

* Translated using Weblate (Spanish)

Currently translated at 81.4% (1615 of 1982 strings)

Translation: mattermost/mattermost-server_master
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-server_master/es/

* Translated using Weblate (Russian)

Currently translated at 100.0% (1982 of 1982 strings)

Translation: mattermost/mattermost-server_master
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-server_master/ru/

Translated using Weblate (Russian)

Currently translated at 100.0% (1982 of 1982 strings)

Translation: mattermost/mattermost-server_master
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-server_master/ru/

Translated using Weblate (Russian)

Currently translated at 83.2% (1651 of 1982 strings)

Translation: mattermost/mattermost-server_master
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-server_master/ru/

* Translated using Weblate (Italian)

Currently translated at 99.8% (1980 of 1982 strings)

Translation: mattermost/mattermost-server_master
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-server_master/it/

* Update translation files

Updated by "Cleanup translation files" hook in Weblate.

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

Update translation files

Updated by "Cleanup translation files" hook in Weblate.

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

Update translation files

Updated by "Cleanup translation files" hook in Weblate.

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

* Deleted translation using Weblate (Malayalam)

Deleted translation using Weblate (Swedish)

Deleted translation using Weblate (Belarusian)

Deleted translation using Weblate (Arabic)

Deleted translation using Weblate (Amharic)

Translated using Weblate (Dutch)

Currently translated at 98.9% (1951 of 1972 strings)

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

Translated using Weblate (Portuguese (Brazil))

Currently translated at 98.8% (1949 of 1972 strings)

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

Translated using Weblate (Polish)

Currently translated at 98.8% (1949 of 1972 strings)

Translation: mattermost/mattermost-server_master
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-server_master/pl/

Translated using Weblate (Spanish)

Currently translated at 98.8% (1949 of 1972 strings)

Translation: mattermost/mattermost-server_master
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-server_master/es/

Translated using Weblate (Japanese)

Currently translated at 98.8% (1949 of 1972 strings)

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

Translated using Weblate (Chinese (Traditional))

Currently translated at 98.8% (1949 of 1972 strings)

Translation: mattermost/mattermost-server_master
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-server_master/zh_Hant/

Translated using Weblate (Italian)

Currently translated at 99.7% (1967 of 1972 strings)

Translation: mattermost/mattermost-server_master
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-server_master/it/

Translated using Weblate (Ukrainian)

Currently translated at 98.8% (1949 of 1972 strings)

Translation: mattermost/mattermost-server_master
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-server_master/uk/

Translated using Weblate (Chinese (Simplified))

Currently translated at 99.6% (1965 of 1972 strings)

Translation: mattermost/mattermost-server_master
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-server_master/zh_Hans/

Translated using Weblate (French)

Currently translated at 98.8% (1949 of 1972 strings)

Translation: mattermost/mattermost-server_master
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-server_master/fr/

Translated using Weblate (Korean)

Currently translated at 98.8% (1949 of 1972 strings)

Translation: mattermost/mattermost-server_master
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-server_master/ko/

Translated using Weblate (Romanian)

Currently translated at 98.8% (1949 of 1972 strings)

Translation: mattermost/mattermost-server_master
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-server_master/ro/

Translated using Weblate (Russian)

Currently translated at 99.8% (1969 of 1972 strings)

Translation: mattermost/mattermost-server_master
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-server_master/ru/

Translated using Weblate (German)

Currently translated at 98.8% (1949 of 1972 strings)

Translation: mattermost/mattermost-server_master
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-server_master/de/

Translated using Weblate (German)

Currently translated at 82.1% (1629 of 1982 strings)

Translation: mattermost/mattermost-server_master
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-server_master/de/

* Update translation files

Updated by "Cleanup translation files" hook in Weblate.

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

* Added translation using Weblate (Belarusian)

Added translation using Weblate (Arabic)

Added translation using Weblate (Swedish)

Added translation using Weblate (Amharic)

* Translated using Weblate (Chinese (Simplified))

Currently translated at 99.8% (1973 of 1975 strings)

Translation: mattermost/mattermost-server_master
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-server_master/zh_Hans/

Translated using Weblate (Chinese (Simplified))

Currently translated at 99.8% (1973 of 1975 strings)

Translation: mattermost/mattermost-server_master
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-server_master/zh_Hans/

* Translated using Weblate (Amharic)

Currently translated at 13.1% (260 of 1975 strings)

Translation: mattermost/mattermost-server_master
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-server_master/am/

* Translated using Weblate (Arabic)

Currently translated at 24.0% (474 of 1975 strings)

Translation: mattermost/mattermost-server_master
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-server_master/ar/

* Translated using Weblate (Russian)

Currently translated at 100.0% (1973 of 1973 strings)

Translation: mattermost/mattermost-server_master
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-server_master/ru/

Translated using Weblate (Russian)

Currently translated at 100.0% (1975 of 1975 strings)

Translation: mattermost/mattermost-server_master
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-server_master/ru/

* Translated using Weblate (Polish)

Currently translated at 98.5% (1947 of 1975 strings)

Translation: mattermost/mattermost-server_master
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-server_master/pl/

* Translated using Weblate (Dutch)

Currently translated at 98.6% (1950 of 1976 strings)

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

* Translated using Weblate (Italian)

Currently translated at 99.8% (1974 of 1976 strings)

Translation: mattermost/mattermost-server_master
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-server_master/it/

Translated using Weblate (Italian)

Currently translated at 99.8% (1974 of 1976 strings)

Translation: mattermost/mattermost-server_master
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-server_master/it/

* Translated using Weblate (German)

Currently translated at 98.1% (1948 of 1985 strings)

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

Translated using Weblate (Dutch)

Currently translated at 98.8% (1954 of 1976 strings)

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

* Translated using Weblate (Korean)

Currently translated at 98.3% (1943 of 1976 strings)

Translation: mattermost/mattermost-server_master
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-server_master/ko/

* Translated using Weblate (Dutch)

Currently translated at 99.8% (1970 of 1972 strings)

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

Translated using Weblate (Dutch)

Currently translated at 99.8% (1974 of 1976 strings)

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

* Update translation files

Updated by "Cleanup translation files" hook in Weblate.

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

* Translated using Weblate (Spanish)

Currently translated at 99.8% (1970 of 1972 strings)

Translation: mattermost/mattermost-server_master
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-server_master/es/

* Translated using Weblate (Japanese)

Currently translated at 99.8% (1972 of 1974 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 99.8% (1971 of 1973 strings)

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

* Translated using Weblate (Dutch)

Currently translated at 99.5% (1977 of 1985 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 99.8% (1972 of 1974 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 99.8% (1972 of 1974 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 99.8% (1971 of 1973 strings)

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

* Translated using Weblate (Romanian)

Currently translated at 100.0% (1974 of 1974 strings)

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

Translated using Weblate (Romanian)

Currently translated at 100.0% (1973 of 1973 strings)

Translation: mattermost/mattermost-server_master
Translate-URL: https://translate.mattermost.com/projects/mattermost/mattermost-server_master/ro/

* Deleted translation using Weblate (Belarusian)

Deleted translation using Weblate (Swedish)

Deleted translation using Weblate (Arabic)

Deleted translation using Weblate (Amharic)

* Translated using Weblate (Portuguese (Brazil))

Currently translated at 98.0% (1935 of 1974 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 99.8% (1972 of 1974 strings)

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

* Translated using Weblate (Chinese (Traditional))

Currently translated at 98.1% (1948 of 1985 strings)

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

Translated using Weblate (Chinese (Simplified))

Currently translated at 99.4% (1974 of 1985 strings)

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

Translated using Weblate (Ukrainian)

Currently translated at 98.1% (1948 of 1985 strings)

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

Translated using Weblate (Turkish)

Currently translated at 100.0% (1985 of 1985 strings)

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

Translated using Weblate (Russian)

Currently translated at 99.6% (1978 of 1985 strings)

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

Translated using Weblate (Romanian)

Currently translated at 99.6% (1979 of 1985 strings)

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

Translated using Weblate (Portuguese (Brazil))

Currently translated at 98.1% (1949 of 1985 strings)

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

Translated using Weblate (Polish)

Currently translated at 98.3% (1952 of 1985 strings)

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

Translated using Weblate (Dutch)

Currently translated at 99.5% (1977 of 1985 strings)

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

Translated using Weblate (Korean)

Currently translated at 98.1% (1948 of 1985 strings)

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

Translated using Weblate (Japanese)

Currently translated at 99.5% (1977 of 1985 strings)

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

Translated using Weblate (Italian)

Currently translated at 99.4% (1975 of 1985 strings)

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

Translated using Weblate (French)

Currently translated at 98.1% (1948 of 1985 strings)

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

Translated using Weblate (Spanish)

Currently translated at 99.4% (1975 of 1985 strings)

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

* Translated using Weblate (Turkish)

Currently translated at 100.0% (1985 of 1985 strings)

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

* Translated using Weblate (Portuguese (Brazil))

Currently translated at 99.8% (1983 of 1985 strings)

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

Co-authored-by: sreekanthgs <mail@sreekanth.in>
Co-authored-by: Tom De Moor <tom@controlaltdieliet.be>
Co-authored-by: Kaya Zeren <kayazeren@gmail.com>
Co-authored-by: aeomin <lin@aeomin.net>
Co-authored-by: Elias  Nahum <elias@mattermost.com>
Co-authored-by: Alexey Napalkov <flynbit@gmail.com>
Co-authored-by: mlongo <m.longo@metalsistem.com>
Co-authored-by: Elisabeth Kulzer <elisabeth.kulzer@mattermost.com>
Co-authored-by: yohannes <yohannesseifu3102@gmail.com>
Co-authored-by: majdy <majdydaood@gmail.com>
Co-authored-by: Daniel Burzmiński <daniel@hectorsky.net>
Co-authored-by: ctlaltdieliet38cb457c2b4c4eb2 <github3@controlaltdieliet.be>
Co-authored-by: potatogim <potatogim@potatogim.net>
Co-authored-by: kaakaa <stooner.hoe@gmail.com>
Co-authored-by: Viorel-Cosmin Miron <cosmin@uhlhost.net>
Co-authored-by: rodrigocorsi <rodrigocorsi@gmail.com>
Co-authored-by: maruTA-bis5 <bis5.wsys@gmail.com>
2020-07-08 12:07:58 +02:00
Jesús Espino
98d5b7a5a5 Fix jobserver run (#14983) 2020-07-08 10:03:02 +02:00
Christopher Speller
bebff8156b MM-26056 Add plugin ability to execute slash command. (#14898)
* Add plugin ability to execute slash command.

* A test

* Add site url to command args for plugin API

* Remove unessiary complexity.
2020-07-07 09:31:03 -07:00
Jesús Espino
b977017ca7 Extracting email functions into a service (#14802)
* Extracting email functions into a service

* Fixing two shadowing errors

* Address PR review comments

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-07-07 10:03:21 +02:00
Agniva De Sarker
10f5a8890c MM-24972: make GetHubForUserId lock-less and zero-alloc (#14945)
* MM-24972: make GetHubForUserId lock-less and zero-alloc

The hubs aren't meant to be modified after the server starts up.
But the key problem was the SetHubs method which would zero out
the underlying hubs slice.

This wasn't ideally necessary because an hub would only be stopped
once during server shutdown. However, this was required by a test
which would shutdown the hub twice. And since the hub shutdown isn't
idempotent, zeroing the slice would just skip over shutting down the hub again.

To improve the overall situation, we apply several optimizations.

- We use the new hash/maphash package which exposes Go runtime's
internal hash algorithms to be used as a package. This is much faster
than hash/fnv.
- We move around the initialization of the hub to happen before
the metrics server starts. This allows us to initialize the hub
before any of the hub elements are being accessed.
- To make the test run successfully, we do not call th.TearDown.
This is fine for a test, because anyways the test process would eventually stop
and relinquish the resources to the OS.

This allows us to completely remove any mutexes and thereby
we can remove all the methods and any edge-case checks related to
index being out of bounds. As a result, the fast path becomes
very straightforward and zero-alloc.

name               old time/op    new time/op    delta
GetHubForUserId-8     116ns ± 1%      38ns ± 7%   -67.22%  (p=0.000 n=10+10)

name               old alloc/op   new alloc/op   delta
GetHubForUserId-8     36.0B ± 0%      0.0B       -100.00%  (p=0.000 n=10+10)

name               old allocs/op  new allocs/op  delta
GetHubForUserId-8      2.00 ± 0%      0.00       -100.00%  (p=0.000 n=10+10)

Manually tested with some load testing and running Hub tests in -race mode.

* remove mutex

* incorporate review comments
2020-07-07 11:23:45 +05:30
Harrison Healey
de6a57cdc3 Sidebar V2 Phase 2 (#14967)
* parent 48256721c4 (#14358)

author Eli Yukelzon <reflog@gmail.com> 1585814774 +0300
committer Eli Yukelzon <reflog@gmail.com> 1589111022 +0300

Sidebar caregories implemented

Apply suggestions from code review

Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>

Update store/sqlstore/channel_store.go

Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>

Update store/sqlstore/channel_store.go

Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>

code review suggestions

status messages

edge case

bugs...

timeout reverse

* MM-25126 Add a separate default sorting method for categories (#14575)

* MM-25158 Add user to initial sidebar categories when joining team (#14570)

* MM-25281  Place new categories in the correct position (#14609)

* MM-25277  Return channels that aren't in a category as part of the Channels/Direct Messages categories (#14601)

* MM-25276  Remove categories when leaving a team (#14600)

* Remove categories when leaving a team

* layers

* corrected cleanup function

* lint

* .

* corrected errors in postgres

* .

* MM-25280  Ensure that the "update category order" API call only contains real category IDs and isn't missing any IDs (#14626)

* Ensure that the "update category order" API call only contains real category IDs and isn't missing any IDs

* tests

* correct status code

* MM-25278  Change "update category" API to return 400 when changing unsupported fields (#14599)

* MM-25279  Change category migration to only populate channels in Favorites (#14627)

* MM-25157 Add API to delete custom categories  (#14574)

* MM-25157 Add API to delete custom categories

* get categories fix

* maxorder fix

* Use correct websocket event when deleting category

* Fix tests and remove debug code

* Actually use the right websocket event this time

* test cleanup

* Update test for new category order

Co-authored-by: Eli Yukelzon <reflog@gmail.com>

* MM-24914 Various fixes for sidebar channel handling (#14756)

* Fix checking for channel membership when reordering channels

* Remove unique constraint on SidebarCategories

* Set column sizes for SidebarCategories and SidebarChannels tables

* Allow changing the sorting method for non-DM categories

* Fix nil pointers in error handling

* Fix orphaned channels from other team being returned in Channels category

* Fix non-orphaned channels being duplicated in the Channels category

* Remove unique constraint on SidebarChannels

* Fix category/name of favorites preferences

* Fix testSidebarChannelsMigration

* Rename err to nErr and appErr to err

* Fix channel order returned by GetSidebarCategories on MySQL

* Fix adding/removing favorites preferences

* Remove leftover TODO

* Change SidebarCategoryType enums to use full names (#14786)

* Change SidebarCategoryType enums to use full names

* Fix Channels constant

* Remove leftover debug code

* MM-24914 Fix updateCategory endpoint returning the wrong type (#14795)

* MM-24914 Make some changes to UpdateSidebarCategories (#14806)

* Fix orphaned DMs not always being returned

* MM-24914 Make some changes to UpdateSidebarCategories

* Run updateSidebarCategoryOrderT in a transaction

* Fix deleting SidebarChannels based on order of arguments to UpdateSidebarCategories

* bump for api testing

* bump for api testing

* Change CreateInitialSidebarCategories to return a plain error

* Change MigrateSidebarCategories to return a plain error

* Remove usage of UpdateColumns when updating sidebar categories (#14843)

* Remove usage of UpdateColumns when changing category order

* Add a random test case

* Remove usage of UpdateColumns when updating sidebar categories (#14843)

* Remove usage of UpdateColumns when changing category order

* Add a random test case

* Remove usage of UpdateColumns when updating sidebar categories (#14843)

* Remove usage of UpdateColumns when changing category order

* Add a random test case

* MM-26343 Make CreateInitialSidebarCategories idempotent (#14870)

* Fix bad merge

* Fix another bad merge

* Fix unintentionally removed i18n string

Co-authored-by: Eli Yukelzon <reflog@gmail.com>
2020-07-06 18:20:35 -04:00
Dušan Panić
83a80a2422 Implemented AmazonS3PathPrefix (#14917)
* Implemented AmazonS3PathPrefix

* Remove unecessary method

* fix for test

* fix for test which are failing

* fix for test which are failing

* fix for test

Co-authored-by: Dusan Panic <dusan@salestrekker.com>
2020-07-07 00:20:13 +02:00
Eric Sadur
70084f107c changing license renewal link to point to new renewal webpage (#14907)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-07-06 14:15:00 -04:00
Agniva De Sarker
58dc0772bc MM-26346: check for nil Message in DisableMentionHighlights (#14972)
Sometimes a PostPatch may not contain the message field. For example,
while pinning a post, only the IsPinned field is set, and everything
else is nil. In that case, DisableMentionHighlights would throw a panic.

We handle that case by checking for nil first.
2020-07-06 20:29:36 +05:30
Ashish Bhate
af8b914c6c MM-23596: Ability to list private channels for team (#14925)
Summary:
store, app, api and go driver support for listing private channels

Ticket Link:
https://mattermost.atlassian.net/browse/MM-23596
2020-07-06 12:34:29 +05:30
Jesús Espino
a4fc0fcfb7 Adding terms_accepted and receive_emails_accepted params to request trial (#14937) 2020-07-03 12:17:34 +02:00
Christopher Speller
3e9ec51890 Mm 16292 support command overrides (#14951)
* Supporing plugins that override built-in commands.

* Test.

* Fix test.

* Fix override order for command autocomplete.

* Fix test copy paste errors

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-07-02 13:28:21 -07:00
Christopher Poile
f5be738923 MM-26339 - Add context and CommandArgs to dynamic autocomplete calls (#14940)
* pass commandArgs and pluginContext to dynamic list suggestion calls

* update tests

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-07-02 08:08:58 -07:00
Agniva De Sarker
71925ea224 MM-26031: Migrate reaction store to plain errors (#14931)
* ReactionStore migration to return plain errors

* Fix translations

* FixImports

* Rollback fix imports

* Fix merge conflict

* add ent translation

Co-authored-by: Rodrigo Villablanca <villa061004@gmail.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-07-02 09:43:28 +05:30
Doug Lauder
00aeca0e5c MM-26064 - ENV var license override (#14943)
* License provided through env var takes precedence over other license sources
2020-07-01 13:27:37 -04:00
Hossein Ahmadian-Yazdi
4c50c7c59b [MM-25780] Fix incorrect session length when logging in through mobile using SSO (#14874)
* Pass device ID

* dont use device id as way of detecting

* fix spelling mistake

* update layers

* fix test

* fix linting

* save schema

* put columns in correct place

* fix linting

* update

* upgrade go change

* use props

* fix stuff

* update session tests

* address PR comments

* address PR comments
2020-06-30 10:34:05 -04:00
Miguel de la Cruz
df943fbf91 [MM-26397] Take query size and order into account for Bleve (#14882)
* [MM-26397] Take query size and order into account for Bleve

* Add a test to check post search pagination

* Add tests for checking limit when searching users

* Make pagination an independent test to discriminate DB engines
2020-06-30 15:38:58 +02:00
Carlos Tadeu Panato Junior
10af90fa27 Update Dockerfile (#14946)
* update alpine base image to 3.12

* update MM package to use 5.24.2 as default
2020-06-30 14:45:17 +02:00
Carlos Tadeu Panato Junior
607d409473 upgrade db to 5.25 (#14947) 2020-06-30 14:44:48 +02:00
Ben Schumacher
43f7acd45a [MM-26507] Send license type for install plugin request (#14913) 2020-06-30 14:17:00 +02:00
Ben Schumacher
a34ea6ad63 [MM-26463] Keep query parameter for interplugin requests (#14905) 2020-06-30 10:13:27 +02:00
Agniva De Sarker
08457860cc MM-26571: Move the semaphore creation before hub start (#14938)
This avoids the race of assigning the sema field from the start method
which runs in a goroutine.

The race that happens is

==================

WARNING: DATA RACE
Write at 0x00c003a9d1b0 by goroutine 67:
  github.com/mattermost/mattermost-server/v5/app.(*PushNotificationsHub).start()
      /home/agniva/mattermost/mattermost-server/app/notification_push.go:264 +0x90

Previous read at 0x00c003a9d1b0 by goroutine 69:
  github.com/mattermost/mattermost-server/v5/app.(*Server).createPushNotificationsHub()
      /home/agniva/mattermost/mattermost-server/app/notification_push.go:260 +0x1d5
2020-06-30 13:15:05 +05:30
Agniva De Sarker
f305cfe9ae MM-26563: Skip TestCreatePostCheckOnlineStatus if timeout exceeds (#14935)
We just skip the test instead of failing because waiting for more than 5 seconds
to get a response does not make sense, and it will unncessarily slow down
the tests further in an already congested CI environment.
2020-06-30 08:25:47 +05:30
Michael Kochell
11bc28b5fb [MM-26532] Support "active" filter on profile search (#14923)
* Support "active" filter on profile search

* Add tests for active user filter
2020-06-29 15:52:46 -04:00
Mario de Frutos Dieguez
bec2f366a7 [MM-24334] Include role filtering in ES search (#14465)
* ES supports role filtering for users

- Added roles field for ES user index
- Include role filtering logic in ES
2020-06-29 21:24:36 +02:00
Jesús Espino
e2e352e223 Change the App dependency with Server in migrations package (#14804)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-06-29 18:00:16 +02:00
Agniva De Sarker
a9ba052207 MM-26206: Add GroupMentions permissions in default channel admin (#14838)
* MM-26206: Add GroupMentions permissions in default channel admin

This permission was skipped from the default permissions function.
Which led to a bug where permissions reset would not bring back
this permission to the different roles.

* Added tests

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-06-29 21:04:29 +05:30
Jesús Espino
05dc928576 Better handling of errors on trial license request (#14886)
* Fix behavior on blank site url on trial requests

* Adding trial license error response handling

* Changing text based on PR review comments
2020-06-29 17:22:50 +02:00
Farhan Munshi
9e12a34e3c [MM-25568] LDAP Sync skip users and log when they dont match the restricted email of a team or channel (#14895)
* Dont return an error if createDefaultChannelMemberships fails due to email domain restriction on team

* Add test ensuring sync works as intended and only skips over failed users

* Remove unneeded line

* Update wording

* Trigger CI
2020-06-29 10:42:03 -04:00
Agniva De Sarker
d3156395a1 MM-25943: Upgrade dependencies for server (#14932)
* MM-25943: Upgrade dependencies for server

* tmp
2020-06-29 17:49:46 +05:30
Miguel de la Cruz
eff2209a7e [MM-25646] Adds the permanent delete all users endpoint to the local API (#14903)
* [MM-25646] Adds the permanent delete all users endpoint to the local API

* Add a check to ensure that teams and channels are not deleted

* Fix linter

* Fix audit record name for consistency with method name

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-06-27 23:00:01 +02:00
Rodrigo Villablanca
48ed86ddc7 Removed dup signal (#14922) 2020-06-27 09:33:36 +02:00
Mario de Frutos Dieguez
4c33b7a35d [MM-25767] Quick switch users search is always falling back to the database (#14762)
* Refactor of getListOfAllowedChannelsForTeam

Also, I've fixed some problematic scenarios:

- The quick search doesn't provide team id so it was always failing
- When the teamId was empty and view restrictions too we always
  return all the channels because if we do "strings.Contains("foo", "")
  it always returns true
- There was a case, in quick search with a guest account, where you
  get an empty result because teamId is not provided

* Error if team id is not passed when searching for the channel

If we search users passing the channel id, we must pass the team id
too so we avoid returning all the channels if we remove the empty
team id restriction we have in the getListOfAllowedChannelsForTeam

There is no known reason to search for a channel but not filtering
using the team id. Even guest accounts belong to a team
2020-06-26 20:37:35 +02:00
Agniva De Sarker
dd40d59c84 MM-26514: Fix ALTER PRIMARY KEY migration for Postgres <9.3 (#14912)
* MM-26514: Fix ALTER PRIMARY KEY migration for Postgres <9.3

We work around the lack of LATERAL keyword by making the query separately.

* Complete full WHERE clause just to be sure
2020-06-26 21:14:37 +05:30
Christopher Poile
4bfad26614 MM-26441 - fix for doPluginRequest (#14897)
* merge rawQuery params with provided values

* tests for doPluginRequest

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-06-26 11:15:04 -03:00
Ibrahim Serdar Acikgoz
f7f1f0d268 [MM-23721] api4/user: add verify user by Id endpoint (#14244)
* api4/user: add verify user by id method

* Update api4/user.go

Co-Authored-By: Miguel de la Cruz <miguel@mcrx.me>

* Update model/client4.go

Co-Authored-By: Miguel de la Cruz <miguel@mcrx.me>

* api4/user: reflect review comments

* Update api4/user_test.go

Co-authored-by: Miguel de la Cruz <miguel@mcrx.me>

Co-authored-by: Miguel de la Cruz <miguel@mcrx.me>
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-06-26 16:08:01 +03:00
Claudio Costa
d0e035467c [MM-16473] Make plugins' ServerHTTP http.ResponseWriter hijackable (#14822)
* Make plugins' ServerHTTP http.ResponseWriter hijackable

* Rename brw to align with docs

* Fix error handling
2020-06-26 10:51:23 +02:00
Rodrigo Villablanca
0118db9d23 Migration of AuditStore to return plain errors (#14825)
Automatic Merge
2020-06-26 06:26:35 +02:00
Agniva De Sarker
98d72e51fe MM-26452: Fix flaky test ChannelStore//SearchInTeam/the_in_name (#14899)
The same problem as #14840 plagues this test too.
2020-06-25 22:26:37 +05:30
Miguel de la Cruz
1ef5523b9f [MM-26390] Ensures the generated team name in sampledata is a valid one (#14901) 2020-06-25 16:00:12 +02:00
Elisabeth Kulzer
89c3b3d5a7 Fix webapp checkout part 2 (#14910)
* Fix webapp checkout part 2

* Use trap instead to not trigger fail commands before.

* Rm trap afterwards.
2020-06-25 14:03:19 +02:00
Mario de Frutos Dieguez
05ec3733c0 [MM-25406] Include missing methods in the search layer (#14799)
* Two missing methods to add in the channel layer

* Added delete user/channel posts methods

- Created in both search engines but only implemented in ES
- Add those methods in the search layer
- Included the PermanentDeleteByUser/Channel methods

* Two new delete documents are included in the bleve code with this
change:

- DeleteChannelPosts
- DeleteUserPosts

These two new functions delete post documents from the index-based
in the filed value provided
2020-06-25 13:45:39 +02:00
Siyuan Liu
aaea36a24d MM-25115 - make cacheProvider2 accessible to localcachelayer (#14691)
* make cacheProvider2 accessible to localcachelayer

* migrate localcachelayer

* revert test.sh

* workaround gob deserialization issue

* fix web_test.go

* merge conflicts

* resolve merge conflicts

* revert back test workaround

* fix the wrong merge
2020-06-25 17:08:53 +05:30
Agniva De Sarker
1648b11e82 MM-25507: Remove old migration state marker before running fresh migration (#14768)
While resetting permissions, we were not removing old migration state residue
for the EMOJIS_PERMISSIONS_MIGRATION_KEY and GUEST_ROLES_CREATION_MIGRATION_KEY.
Therefore, during their migration, they got skipped because the code checks
if a migration key is already present or not.

To fix this, we remove the migration key just as we do for ADVANCED_PERMISSIONS_MIGRATION_KEY.

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-06-25 13:36:47 +05:30