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

12421 Коммитов

Автор SHA1 Сообщение Дата
Eli Yukelzon
008961ba2f MM-20951 Add sentry support to mattermost-server (#14405) 2020-05-21 16:13:37 +03:00
Shota Gvinepadze
43e606173b [MM-20684] Slash Command Autocomplete (#14557)
* [MM-20684] Initial implementation of the Command Autocomplete (#13602)

* Implement Autocomplete Data

* Change CommandName to Trigger

* Fix Autocomplete test

* Make stylistic changes

* Rename a bunch of fields and methods

* Fix variable names, safer type assertions

* [MM-20684] plugin autocomplete implementation (#14259)

* Add an endpoint for command autocomplete suggestions

* Add full Suggestion to the AutocompleteSugestion struct

* Add Dynamic Argument support

* Tidy up things

* Fix missed test case

* Add support of the named arguments

* Update autocomplete API

Fix review issues

Implement dynamic args as a local request

* Fix ineffassign

* Add support of the uppercase letters in arguments

* Add support of the optional arguments

* Remove ineffectual assignment

* Add support for icons (#14489)

* Address couple of nits

* Add comment to IconData

* Add types to all consts

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-21 12:24:56 +04:00
Martin Kraft
e8daab6b84 MM-25369: Disable Brotli in 'dev' mode. (#14608) 2020-05-20 19:05:21 -04:00
Hossein Ahmadian-Yazdi
173cfe9b88 [MM-22644] Dont allow message export for CSV, Acadiance, Global Relay if non-E20 customer via command line (#14584)
* dont allow message export for non E20 if export to csv acadiance or global relay

* add tests

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-20 11:20:27 -04:00
Harrison Healey
f62493145a MM-24386/MM-24465 Enable link previews and full push notifications by default (#14565)
* MM-24386 Update default push notification contents to full

* MM-24465 Enable link previews by default

* Fix a unit test relying on the old default
2020-05-20 09:23:13 -04:00
Agniva De Sarker
aad76a13e8 MM-24170: Allow mysql to choose the right index (#14588)
We use the same optimization used in MM-23369 to prevent
mysql from using the index in the sort query.

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-20 09:34:55 +05:30
Agniva De Sarker
15ed9a8f20 MM-25006: Fix occurences of unclosed http bodies (#14521)
* MM-25006: Fix occurences of unclosed http bodies

And while here, we also use ioutil.Discard to read the remaining
body instead of reading with ioutil.ReadAll which allocates a separate
byte buffer.

* Fix mistake

* Address review comments

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-20 08:41:37 +05:30
Jesse Hallam
ee8bd4ece4 MM-23250: improve config.Migrate tests (#14479)
* MM-23250: improve config.Migrate tests

The config.Migrate tests were not running in isolation, but wrote over the "local" config. The test coverage for both directions was not exhaustive, and lacked coverage for the recently added plugin signature files.

Rewrite the unit tests as such, fixing a minor issue closing the stores after migration.

Fixes: https://mattermost.atlassian.net/browse/MM-23250

* idiomatic err checking

* clarify random file contents

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-19 21:03:02 -03:00
Miguel de la Cruz
0154b8059b [MM-20979] Add first implementation of the Bleve search engine (#14562)
* [MM-20979] Add first implementation of the Bleve search engine

* Fix i18n

* Migrate searchengine utils tests

* Fix linter

* Don't add allTermsQ if both termQueries and notTermQueries are empty

* Fix test that should work if user is system admin

* Modify naming according to review comments

* Abstract getIndexDir function

* Extracting bleve engine name as a constant

* Merge both Indexer interfaces into one

* Add worker stopped message

* Allow worker to be started/stopped with config change

* Use constants for index names

* Modify test order

* Fix linter

* Trying to unlock the CI
2020-05-20 01:29:55 +02:00
Ben Schumacher
8d0343d2eb [MM-22734] Support different interactive message button styles (#14592) 2020-05-19 18:41:17 +02:00
Doug Lauder
906508ee3b MM-25256 don't idle timeout expire session on mobile (#14583) 2020-05-19 12:26:54 -04:00
Miguel de la Cruz
0d89ff5d0e Mm 23710 mmctl local mode (#14561)
* [MM-24146] Add unix socket listener for mmctl local mode (#14296)

* add unix socket listener for mmctl local mode

* add a constant for local-mode socket path

* reflect review comments

* [MM-24401] Base approach for Local Mode (#14333)

* add unix socket listener for mmctl local mode

* First working PoC

* Adds the channel list endpoint

* Add team list endpoint

* Add a LocalClient to the api test helper and start local mode

* Add helper to test with both SystemAdmin and Local clients

* Add some docs

* Adds TestForAllClients test helper

* Incorporating @ashishbhate's proposal for adding test names to the helpers

* Fix init errors after merge

* Adds create channel tests

* Always init local mode to allow for enabling-disabling it via config

* Check the RemoteAddr of the request before marking session as local

* Mark the request as errored if it's local and the origin is remote

* Set the socket permissions to read/write when initialising

* Fix linter

* Replace RemoteAddr check to ditch connections with the IP:PORT shape

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

* Fix translations order

* [MM-24832] Migrate plugin endpoints to local mode (#14543)

* [MM-24832] Migrate plugin endpoints to local mode

* Fix client reference in helper

* [MM-24776] Migrate config endpoints to local mode (#14544)

* [MM-24776] Migrate get config endpoint to local mode

* [MM-24777] Migrate update config endpoint to local mode

* Fix update config to bypass RestrictSystemAdmin flag

* Add patchConfig endpoint

* MM-24774/MM-24755: local mode for addLicense and removeLicense (#14491)

Automatic Merge

Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
Co-authored-by: Ashish Bhate <bhate.ashish@gmail.com>
2020-05-19 18:20:41 +02:00
Scott Bishel
e8081b7a0f MM24459: Implement ldap picture sync (#14540)
* implement ldap picture sync

* add testing timeout, and no change

* Revert "add testing timeout, and no change"

This reverts commit 765621a7290074e5664c4ca2a2843c84e01f4cf1.

* update app-layer

* updates from code review

* update app-layers

* remove debug statements

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-19 08:25:52 -06:00
Martin Kraft
d7cb890f34 MM-25095: Handles static JS and CSS using Brotli encoding. (#14524)
* MM-25095: Handles static JS and CSS files using Brotli.

* MM-25095: Linting fix.

* MM-25095: Adds missing license.

* MM-25095: Moves initialization of slice.

* MM-25095: Moves initialization of slice.
2020-05-19 08:40:13 -04:00
George Goldberg
6ae9513474 MM-24176: Regenerate invite ID on team privacy change. (#14529)
* MM-24176: Regenerate invite ID on team privacy change.

* Fix the other place this setting can be changed.

* Fix tests.

* Satisfy the tyrannical golangci-lint.
2020-05-19 12:04:51 +01:00
dantepippi
83c1723bf5 [MM-24663] Refactor link metadata store to use squirrel (#14464)
* Refactor link_metadata_store to use squirrel

* Fix sql buil error string

* Fix := on second err

* Merging code to a single Where call

* Saving a line.

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

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Dante Pippi <dantepippi@gmai.com>
Co-authored-by: dantepippi <dantepippi@users.noreply.github.com>
Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
2020-05-19 09:30:05 +02:00
Agniva De Sarker
53cc7a26ea MM-24133: Migrate AppError from bot_store.go (#14339)
* MM-24135: Migrate AppError from SaveChannel/channel_store.go

This is the first POC of migration of store app errors to plain error.

We create a few basic error types in the store package and use
them to return the errors from store methods. In the app layer,
we inspect the error and re-create the exact app errors. This lets
us preserve the same error content, but yet move to plain errors.

Since this is a gradual migration, this means that the error inspection
code will be duplicated across the app layer whenever a store method
is invoked. But all of that should go away once we start propagating
the errors higher up the hierarchy.

There have been a significant amount of changes in the storetest and searchtest
layer, primarily because we have to rename the err variable now that it is of
a different type.

* Addressed review comments

* MM-24132: Migrate AppError from SaveDirectChannel/channel_store.go

This PR migrates 2 new methods SaveDirectChannel and CreateDirectChannel
to return error instead of AppError.

We also need to handle the error internally in SaveMultipleMember for now
until that is migrated too.

* MM-24133: Migrate AppError from bot_store.go

* Fix errors

* Fix err

* Fix bad return

* Fix vet errors

* Fix incorrect error check

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-19 08:36:53 +05:30
catalintomai
6dc8eccc13 MM-23395: Add websockets support for update group (#14202)
* MM-23395: add websockets support for update group
2020-05-18 09:43:26 -07:00
Federico Martín Alconada Verzini
94dbb09906 [GH-13463] add unit tests to the ChannelCreateCmd mmctl command (#14177)
* add unit tests to the ChannelCreateCmd mmctl command

* fix showed variables

* remove extra whitespace

* add errors check to tests

Co-authored-by: Federico Martín Alconada Verzini <fedealconada@gmail.com>
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-18 09:43:24 +03:00
Agniva De Sarker
bb172aea71 MM-25007: Add staticcheck (#14522) 2020-05-15 17:57:15 +02:00
Agniva De Sarker
21af1f49f1 MM-25238: Fix system ping check to read from master (#14580)
The code was writing to master and immediately after that reading
from a replica causing it to fail intermittently.

Since this is not a very high-traffic table, it should be safe to read
from master always.
2020-05-15 14:19:46 +05:30
Doug Lauder
76ed77663a MM-23706 search executable dir before working dir when looking for i18n (#14241)
* MM-23706 search executable dir before working dir when looking for i18n
2020-05-14 20:11:22 -04:00
Scott Bishel
e6bbb4bd7a MM-24082: Add PictureAttribute to LDAP Settings in config (#14506)
* add new config setting for profile picture attribute

* update attribute names

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-14 13:25:23 -06:00
Agniva De Sarker
090743de86 MM-24132: Migrate AppError from SaveDirectChannel/channel_store.go (#14318)
* MM-24135: Migrate AppError from SaveChannel/channel_store.go

This is the first POC of migration of store app errors to plain error.

We create a few basic error types in the store package and use
them to return the errors from store methods. In the app layer,
we inspect the error and re-create the exact app errors. This lets
us preserve the same error content, but yet move to plain errors.

Since this is a gradual migration, this means that the error inspection
code will be duplicated across the app layer whenever a store method
is invoked. But all of that should go away once we start propagating
the errors higher up the hierarchy.

There have been a significant amount of changes in the storetest and searchtest
layer, primarily because we have to rename the err variable now that it is of
a different type.

* Addressed review comments

* MM-24132: Migrate AppError from SaveDirectChannel/channel_store.go

This PR migrates 2 new methods SaveDirectChannel and CreateDirectChannel
to return error instead of AppError.

We also need to handle the error internally in SaveMultipleMember for now
until that is migrated too.

* Fix layers

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-14 23:41:05 +05:30
Agniva De Sarker
624980ff54 MM-25005: Remove HttpRequestsDuration bucket (#14520)
* MM-25005: Remove HttpRequestsDuration bucket

The ApiTimesHistograms already captures what HttpRequestsDuration does.
And it's more granular than that. So there's no need to duplicate stuff.
Let's remove this one.

* Updating resource class to xlarge

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Jason Deland <jaydeland@gmail.com>
2020-05-14 10:53:55 +05:30
Jason Deland
5686268a5a Update to xLarge resource 2020-05-13 15:28:55 -04:00
Farhan Munshi
599bd93258 MM-25016 Send group Name to in out of channel group users message (#14537) 2020-05-13 13:41:28 -04:00
Doug Lauder
e27b86cae0 expose ServiceSettings.ExtendSessionLengthWithActivity config to clients (#14516) 2020-05-13 12:31:43 -04:00
Miguel de la Cruz
4fde004a5b [MM-23535] Add disable database search flag and return empty posts results if set (#14245)
* [MM-23535] Add disable database search flag and return empty posts results if set

* Add UpdateConfig function for the SearchStore and hook it into the app lifecycle

* Add the config listener in the server instance instead of using FakeApp

* Instantiate searchlayer as a pointer to avoid passing around copies of it
2020-05-13 14:00:57 +02:00
Sayantan Das
288ed40e8f Retry on failed download of plugins from marketplace. (#14176)
* Retry on failed download of plugins from marketplace.

* minor polishing.

* Handling http errors during downloading
Adding unit test for DownloadFromURL

* Adding suggested changes from the PR
Close response body before returning error during progressive retry
Remove separate struct for the downloadURL parameter in download_test
Adding comment to clarify the share retries variable
Changing to NoError and Error in the test assertion.

* Added license header to download_test.go

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-13 08:36:43 +05:30
Flavia Bastos
e03fca5032 Document sqlTeamStore GetAll methods (#14372)
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-12 20:47:10 +02:00
Agniva De Sarker
729a84a3e6 MM-24135: Migrate AppError from SaveChannel/channel_store.go (#14299)
* MM-24135: Migrate AppError from SaveChannel/channel_store.go

This is the first POC of migration of store app errors to plain error.

We create a few basic error types in the store package and use
them to return the errors from store methods. In the app layer,
we inspect the error and re-create the exact app errors. This lets
us preserve the same error content, but yet move to plain errors.

Since this is a gradual migration, this means that the error inspection
code will be duplicated across the app layer whenever a store method
is invoked. But all of that should go away once we start propagating
the errors higher up the hierarchy.

There have been a significant amount of changes in the storetest and searchtest
layer, primarily because we have to rename the err variable now that it is of
a different type.

* Addressed review comments

* Made all appError origins to be CreateChannel

* Remove typed internal error

* Fix translations

* fix layer generation

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-12 21:23:41 +05:30
catalintomai
41e58d9769 MM-23816: Group Mentions: Add ability to rename group names (#14338)
* MM-23816: Group Mentions: Add ability to rename group names
2020-05-12 08:35:03 -07:00
Agniva De Sarker
9dc64173dc MM-24817: Bump hashicorp/memberlist (#14467)
Automatic Merge
2020-05-12 08:32:16 -07:00
Doug Lauder
65733f4969 MM-24644 fix infinite loop splitting post attachments (#14542) 2020-05-12 09:58:19 -04:00
Agniva De Sarker
88481862f7 MM-24911: re-add the reactions table migration (#14487)
Adding the line to migrate it in 5.24

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-12 18:57:29 +05:30
Agniva De Sarker
4fe52d677c MM-24652: Bump golangci to 1.25.1 (#14409)
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-12 10:36:58 +05:30
Agniva De Sarker
c7f53cf02b MM-24759: fix order of calling SetstatusOnline (#14450)
We would call SetStatusOnline in a goroutine before actually calling HubRegister.
This could cause the message not to be sent after all, because there's no guarantee
that Register would actually happen before it.

To fix it, we just change the order of things.

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-12 00:16:24 +05:30
Martin Kraft
3f6c9ab40c Adds server awareness. (#14271)
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-11 11:45:54 -04:00
Eli Yukelzon
744ec281d2 Layer generators error return type fix (#14526) 2020-05-11 12:37:02 +03:00
Agniva De Sarker
2e1dc79a03 Remove concurrent write to websocket connection (#14527)
This test writes directly to a connection
which causes panics and more frustration in an already fragile CI.

Since this anyways checks an edge condition, and will anyways be
removed in v6, let's remove this for now and let CI be happy.
2020-05-11 13:19:00 +05:30
Agniva De Sarker
48256721c4 MM-24611: Fix flaky test TestDeletePreferencesWebsocket (#14399)
After registering the conn in the hub, we proceeded to send a
direct message to the user. We had changed it to send the direct message
in the same hub goroutine that handles the registration. This was the correct
behavior and fixes chances of having panics due to sending to closed channels.

However, often fixing something unearths some deeper underlying bug. This was
such a case :)

The issue was that register channel had a buffer size of 1. And we were sending
a direct message after registration. In the code to send direct message, we
were checking if the user has been registered or not, and if not, then skip it.

Therefore, since the register channel buffer was 1, it could very well be that
the select case would pick up the direct message send case first - in which
case it would not have been registered, and therefore no hello message would be sent.

The fix is to unbuffer the register and unregister channels. There does not seem
to be a valid reason to make these buffered channels. They are meant to be
synchronous operations, because the code following them assumes that the user
has been registered.

While here, we also remove all the time.Sleeps before waiting on the Response channel
because they are not required at all. Waiting on a channel is already blocking.

Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
2020-05-09 08:45:03 +05:30
Farhan Munshi
fff93cb73f [MM-24987] Dont call GetSchemeRolesForChannel and instead load the scheme from channel (#14514)
* MM-24987 Dont call a.GetSchemeRolesForChannel and instead load the scheme using the channel directly

* Trigger CI

* MM-24987 Add a test for concurrent patch to channel moderation

* MM-24987 Cleanup
2020-05-08 17:50:45 -04:00
Farhan Munshi
8fe003876d [MM-24828] Take into account group synced state of team and channel when sending notifications (#14477)
* MM-24828 Take into account group synced state of team and channel when getting groups for mentions

* Update app/notification_test.go

* i18n-extract

* Revert "i18n-extract"

This reverts commit dcb0426b98afa4646c26870c0e3a1236f99fda17.

* Trigger CI

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-08 16:32:48 -04:00
Farhan Munshi
0d1eb02341 [MM-24827] Disable group mentions on e10 or team edition (#14475)
* MM-24827 Disable group mentions when ldap groups not enabled

* Trigger CI

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-08 14:19:01 -04:00
Martin Kraft
4c2d34b097 Fix log message typo. (#14472) 2020-05-08 13:51:52 -04:00
Agniva De Sarker
82e27982d0 MM-24310: Recycle DB connections properly (#14378)
Automatic Merge
2020-05-07 22:03:54 -07:00
Scott Bishel
80c846412d MM-24692: Add a since parameter to getGroups api (#14444)
* add a since parameter to getGroups api

* update for lint error

* when using since, return deleted groups as well.

* update flaky test, groups have same create time

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-07 14:35:09 -06:00
Scott Bishel
1031e27fd8 MM-23038: Compliance Report Fixes (#14242)
* add warning count as return value

* add warning count as return value

* fix file name

* update mock

* add setting warning to db

* replace wrongly removed string

* add dummy function to see if it will build

* remove dummy function

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-07 14:12:47 -06:00
Scott Bishel
bdd0e9febb MM-24694: Add getGroupsByUserId to API layer (#14443)
* add getGroupsByUserId to API layer

* update for lint errors

* add check for contextId = userId or ManageSystem Permission

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-07 13:35:56 -06:00