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

12474 Коммитов

Автор SHA1 Сообщение Дата
Agniva De Sarker
fc028e703a MM-25641: Check if member was deleted in HasPermissionToTeam (#14737)
This PR adds a check to verify if a team member got deleted in HasPermissionToTeam,
and accordingly returns false.
2020-06-03 13:30:32 +05:30
Jesús Espino
e0edd2bebb Add trial license api (#14603)
* Initial request trial api creation

* Adding test license public certificate

* Adding go client method

* Applying changes to use production environment

* Removing accidentally added strings

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-06-02 21:34:15 +02:00
Rodrigo Villablanca
1c9891c65e Migrate all methods of SqlEmojiStore to return plain error intead of *model.AppError (#14618)
Automatic Merge
2020-06-02 11:31:30 -07:00
Rodrigo Villablanca
52cf817c8e SqlTermsOfService migrates to plain errors (#14675)
* Advances migragint TermsOfService

* Advances...

* Replaced message key

* Replaced message key

* Replaced message key

* Replaced message key

* Refactor name of errors

* Fix mixed type of error

* Fix-imports

* i18n-extract

* Rollback changes

* Rollback changes

* Rollback changes

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-06-02 22:47:52 +05:30
Rodrigo Villablanca
85a69d6112 Migrate Get/GetFromMaster methods from ChannelStore to return error interface (#14688)
* Advances

* Migration finished

* Rename err to normalized error

* fix imports

* Renamed key

* Renamed key

* Suggestions

* Fix i18n

* Fix tests

Co-authored-by: Jesús Espino <jespinog@gmail.com>
Co-authored-by: Agniva De Sarker <agnivade@yahoo.co.in>
2020-06-02 21:58:29 +05:30
Rodrigo Villablanca
60cc775cf6 Migrate Update method from ChannelStore to return idiomatic plain error (#14687)
* Partial advances

* Update migrated

* Fix imports

* Suggestions

* Suggestions

* Updating i18n

Co-authored-by: Jesús Espino <jespinog@gmail.com>
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-06-02 20:50:34 +05:30
Siyuan Liu
6a5dd550c8 migrate direct usage of lru to cache2 (#14508)
Automatic Merge
2020-06-02 06:01:30 -07:00
Jesús Espino
18cd3a1d07 Fixing reply count on new posts (#14312)
* Fixing reply count on new posts

* Fixing tests

* Fixing post reply count on getPostsAround

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-06-02 14:16:46 +02:00
Elisabeth Kulzer
9e9c47bdf5 Fix webapp checkout (#14730) 2020-06-02 13:52:14 +02:00
dantepippi
c5af40988c [MM-24945] Refactor job store to use squirrel (#14559)
* Refactor job store to use squirrel

* Using multiple Set calls instead of SetMap

* Commiting suggestions.

Co-authored-by: Miguel de la Cruz <mgdelacroix@gmail.com>

* Commiting suggestions.

Co-authored-by: Miguel de la Cruz <mgdelacroix@gmail.com>

Co-authored-by: Dante Pippi <dantepippi@gmai.com>
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Miguel de la Cruz <mgdelacroix@gmail.com>
2020-06-02 11:42:31 +02:00
Siyuan Liu
c183a5d380 MM-25115- migrate post, session and status cache to cache2 (#14667)
* use cache2.Provider cache

* use cache2.Provider cache

* clean up imports

* reset test runner

* add close() call

* Fixing i18n

* address review comments

Co-authored-by: Jesús Espino <jespinog@gmail.com>
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-06-02 14:47:00 +05:30
Mario de Frutos Dieguez
beadeaf8b5 [MM-25677] Content-Type is optional (#14705)
* Content-Type is optional

mime.ParseMimeType returns and "no media type" error if the passed
string is empty.

Given that the Content-Type header is optional we shouldn't return an error
in that case, so we're fixing that allowing the users to call the webhook
without passing that header

* Include webhook id in the error message

Given that the number of webhooks could be big the user could
need the id to check which one of the multiple webhooks are failing
so include the id aids in that part
2020-06-01 21:07:02 +02:00
Miguel de la Cruz
6643a7c610 [MM-25538] Adds the termOperator and takes it into account for terms and hashtag queries (#14664)
Automatic Merge
2020-06-01 11:31:30 -07:00
Ashish Bhate
8d4da8b968 MM-25073/MM-25074: local mode for getGroupsByChannel and getGroupsByTeam (#14668)
* local mode for getGroupsByChannel

* local mode for getGroupsByTeam
2020-06-01 12:01:05 +02:00
Eli Yukelzon
2af00f73c0 MM-24847 MM-24484 MM-24850 MM-24849 - local mode for commands (#14571)
* 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

* [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

* 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

* added update/move/get/delete command in local mode

* merge fix

* .

Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
Co-authored-by: Miguel de la Cruz <miguel@mcrx.me>
2020-05-31 16:57:04 +02:00
Jason Blais
d1788cab85 Add Jitsi plugin to diagnostics (#14684)
Automatic Merge
2020-05-30 14:31:30 -07:00
Flavia Bastos
54a4c10ed4 Document sqlTeamStore get methods (#14567)
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-30 12:02:10 +02:00
Martin Kraft
c529d5190a MM-25040: Restrict associated groups to channels when team is group-constrained. (#14619)
* MM-25040: Only return team-associated groups if the team is group-constrained.
MM-25040: Prevents associating a group to a channel if the team doesn't have the group first.

* MM-25040: Fix lints.

* MM-25040: Still add the groupteam if the team is not group-constrained.

* MM-25040: Wraps groupteam upsert in else branch for efficiency.

* MM-25040: Removes unnecessary page iteration.

* MM-25040: Fix typo.

* MM-25040: Moves filtering to SQL.

* MM-25040: Updates tests, check pagination.

* MM-25040: Fix lint error.

* MM-25040: Adds some more group store tests.

* MM-25040: Fix for wrong test parameter.
2020-05-29 10:46:52 -04:00
Mario de Frutos Dieguez
c9cdeba1a7 Move StatusStore.GetByIds away from gorp (#14685)
We're removing the usage of gorp in some of the most used
queries in our system. This is one of them
2020-05-29 11:36:41 +02:00
Martin Kraft
e83cc7357c MM-24517: Add newly created channel admin role to all clients' redux state. (#14635)
* MM-24517: Add newly created channel admin role to redux state.

* MM-24517: Adds comment; fixes lint errors.
2020-05-28 14:38:27 -04:00
Nassim Bounouas
41ddbeb642 MM-21307 Get/Update/Delete user preferences Plugin API (#13962)
* MM-21307 Get/Update/Delete user preferences Plugin API

* MM-21307 additional test case on TestPluginAPIDeleteUserPreferences

* MM-21307 remove useless loop

* Update plugin/api.go

* Update plugin/api.go

* Update plugin/api.go

* Update plugin/api.go

* Update plugin/api.go

* Update plugin/api.go

* gofmt -s

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Jesse Hallam <jesse.hallam@gmail.com>
2020-05-28 14:15:47 -03:00
Agniva De Sarker
79a46dd1d3 MM-24481: Use atomics for load/store of client configs (#14648)
There are 3 client config related variables which are set in regenerateClientConfig
but can be read from public methods in the App struct.

We use the same approach as the license fields in the App struct and use atomic.Value
for modifying them.

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-27 22:50:20 +05:30
shred86
c35a18d15c Add ShowFullName property (#14189) 2020-05-27 18:23:51 +02:00
Seweryn Zeman
853e955b62 Change Dockerfile HEALTHCHECK intervals (#14317)
We should not use such a long `HEALTHCHECK` `--interval` as first task check if happening after given time, and before healthcheck returns `0` – **task won't be available** to the Docker networks – meaning that Mattermost won't work until then even if it deployed correctly!

And in Docker envs it happens often – that DB is available all the time, and just MM app is being updated. In this case even if we are healthy since 1s – we need to wait 5min until it goes online.
2020-05-27 17:19:43 +02:00
Farhan Munshi
198fdc8221 [MM-25388] Add telemetry for default picture attribute (#14661)
* MM-25388 Add telemetry for default picture attribute

* Rename to isempty

* rename to isnotempty
2020-05-27 10:24:58 -04:00
Jesús Espino
ae328153d5 Fixing behavior of Replicas and SearchReplicas in canary environments (#14576)
* Fixing behavior of Replicas and SearchReplicas in canary environments

* Trying to fix tests

* Revert "Trying to fix tests"

This reverts commit 3531da961844f5cb8557efcd3b570b06f362c6df.

* Revert "Fixing behavior of Replicas and SearchReplicas in canary environments"

This reverts commit 0c05901c843e4ccd60c8320fb4e0123b1bacf430.

* Revert "Disable read/search db replicas in TE/E0 (#14400)"

This reverts commit ef5ac519d9.

* Making the store aware of the license

* Readding the unit tests

* Fixing sqlstor supplier tests

* Adding mutex to ensure license write consistency and fixing tests

* Fixing tests

* Fixing tests

* Shuting down server properly during tests

* Trying to fix tests

* Trying to fix the tests

* Skipping flaky tests

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-27 15:42:48 +02:00
Eli Yukelzon
553af3a694 MM-24597 Migrate API handler deleteChannel to be compatible with local mode (#14532)
Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
Co-authored-by: Miguel de la Cruz <miguel@mcrx.me>
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-27 16:24:44 +03:00
Harshil Sharma
dea705969c MM-13934 - Plugin helper function EnsureBot doesn't compare bot details (#14103) 2020-05-27 14:48:43 +02:00
Agniva De Sarker
14f7118dde MM-22706: pass along set_online flag in websocket response (#14591)
* MM-22706: pass along set_online flag in websocket response

To let the client know whether a user has created a post without
being online or not, we get the set_online query param and
pass it down to the websocket event being passed down to the client.

With this PR, the "data" field of the `posted` event will contain
a `set_online` boolean field set to true/false depending on the
query_param set_online value set in the createPost call.

* Setting to false for auto responder

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-27 17:35:02 +05:30
Eli Yukelzon
b9309b2af1 MM-24595 Migrate API handler getChannelMember(s) to be compatible with local mode (#14533)
Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
Co-authored-by: Miguel de la Cruz <miguel@mcrx.me>
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-27 14:58:39 +03:00
Claudio Costa
cedcb63e83 [MM-24123] Fix flaky TestGetLinkMetadata (#14654)
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-27 14:58:05 +03:00
Fedor Vitkovskiy
b660ffee01 Fix tests for guest accounts count (#14311)
Co-authored-by: Fedor Vitkovskiy <fedorvitkovskiy@pop-os.localdomain>
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Jesús Espino <jespinog@gmail.com>
Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
2020-05-27 12:36:53 +02:00
Ben Schumacher
9e91f2ad33 Bump app version to 5.26 (#14649) 2020-05-27 12:07:44 +02:00
Siyuan Liu
b733762575 provide and implement a new cache provider (#14496)
* provide and implement a new cache provider

* make interface more flexible

* let Connect and Close return error

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-27 08:46:07 +05:30
Scott Bishel
ebece6c23a MM-25014 - Default Group Name to null, until AllowGroupReference is set (#14651)
* make Group.Name a pointer to allow null

* fix unit tests

* fix build error

* fix unit test

* ensure Name field not nil

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-26 19:21:29 -06:00
Claudio Costa
91f010b8b7 Fix client4.GetPluginStatuses() (#14629)
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-25 21:07:09 +02:00
Agniva De Sarker
932d6c2cbf Migrate tool dependencies to go.tools.mod (#14646)
Go 1.14 introduces usage of alternate go.mod files to track
other dependencies which are not related to the main app.
We use this to track all tool dependencies so that everybody uses
the same version of all tools, including CI.

This will prevent version conflicts due to everybody using different
versions of the tools.
And it will not try to upgrade the tool version, every single time,
one runs the tool command.

While here, we also re-generate some filestore mocks which weren't up to date.

Fixes #13088

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-25 23:20:44 +05:30
Agniva De Sarker
25fb1296af Check for nil error in ErrConflict (#14636)
We check if the err is nil or not before calling the Error() method.

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-25 18:38:11 +05:30
Jason Blais
235c53189e Add ?src=docker query parameter to identify download source (#14577)
Automatic Merge
2020-05-25 04:29:18 -07:00
Mario de Frutos Dieguez
f135e6c1bf [MM-24453] Sanitize user term search (#14494)
* Sanitize user term search

Remove the @ at the beginning of the search term in order to
make it possible for ES to return results
2020-05-24 10:50:07 +02:00
Arianna Vespri
2135096d88 Convert bool string comparisons to strconv.ParseBool for REST parameters (#13650)
* Convert bool string comparisons to strconv.ParseBool for REST parameters

* Log failed bool conversions

* Rename errors, changed log levels

* drop strconv.ParseBool error handling

If the query string parameter is omitted, strconv.ParseBool returns an error for the empty strings, which spams the logs. Instead, just assume the default semantics of a `false` return value if an error occurs.

* allow randomized Client4 booleans

It's hard to test api4's handling of the various boolean input values
accepted. Extend Client4 with support for overriding how it builds those
strings, and pick a random value on test startup.

* gofmt -s

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
Co-authored-by: Jesse Hallam <jesse.hallam@gmail.com>
2020-05-24 05:01:31 +08:00
Agniva De Sarker
f7a91c7cf9 MM-24830: Add event constants for gossip request/response (#14611)
* MM-24830: Add event constants for gossip request/response

This is an accompanying PR for the shift to entirely gossip.

* Fix order

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-23 11:43:58 +05:30
Ben Schumacher
23ecc9ad0a [MM-25284] Include license type in Marketplace request (#14586) 2020-05-23 07:05:51 +02:00
Agniva De Sarker
d317dd2dde MM-25154: Fix data race in InvokeClusterLeaderChangedListener (#14610)
The order of booting up a server should be
Job scheduler -> Cluster.

And shutdown should be the opposite. This is needed because the job scheduler
initializes certain data structures that are later called by ClusterLeaderChanged
event handlers. And the event handlers run in a separate goroutine.

Therefore, if the cluster initialization happens before the job scheduler,
then a race happens between accessing the jobs variable and setting it.

To prevent this race, we fix the order of startup, and add comments in both
places to prevent things from regressing again.
2020-05-22 23:52:25 +05:30
Jason Blais
c1d0faa2e5 Fix typo (alredy -> already), add missing periods (#14631)
Automatic Merge
2020-05-22 10:44:22 -07:00
Agniva De Sarker
a014a71c94 MM-25413: Fix empty localization string (#14623) 2020-05-22 22:29:19 +05:30
Farhan Munshi
b0d74c4e40 [MM-25385] Add group_count_with_allow_reference telemetry (#14614)
* MM-25385 Add group_count_with_allow_reference telemetry

* Add store layers

* Fix tests

* Fix linting
2020-05-22 10:56:15 -04:00
Ashish Bhate
33bfebc797 MM-24845/MM-24846: local mode handler for createCommand and listCommands (#14486)
* Add local mode handler for createCommand
* Add local mode handler for listCommands
* Fix bad merge

Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
Co-authored-by: Miguel de la Cruz <miguel@mcrx.me>
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-05-22 17:18:22 +05:30
Ashish Bhate
ea86dc9a62 MM-24872/MM-24873: local mode support for addTeamMember and removeTeamMember (#14534)
* Add local mode handler for addTeamMember

* Add local mode handler for remoteTeamMember

* short circuit session team permission for local mode

Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
Co-authored-by: Miguel de la Cruz <miguel@mcrx.me>
2020-05-22 15:52:57 +05:30
Agniva De Sarker
abce5d620f MM-25439: Skip SuddenClose flaky test (#14628)
Automatic Merge
2020-05-22 02:44:42 -07:00