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

1944 Коммитов

Автор SHA1 Сообщение Дата
Mario de Frutos Dieguez
89f4e9d7ef Metrics operations shouldn't be inside goroutine (#13950)
Metrics operations are done in memory so there is no need
to spawn a new goroutine
2020-03-03 16:23:32 +05:30
Farhan Munshi
aec606500f [MM-22622] Add Ephemeral response when using mentions without permissions (#13902)
* MM-22282 Add Ephemeral response when using mentions without permission and add new prop to disable mention highlights on client

* MM-22622 Make test name test actually what it does and fix comment style

* MM-22622 Check ephemeral post created when post create with mentions on API

* MM-22622 More tests for App>CreatePost

* MM-22622 Make DisableMentionHighlights more concise and rename ephemeral post

* MM-22622 Dont send ephemeral message for system message created by user

* Trigger build
2020-03-03 15:52:49 +05:30
Jason Frerich
4c7fee7ac8 [MM-22485] Sync bot message to message displayed in webapp (#13867)
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-03-02 15:57:29 -06:00
Mario de Frutos Dieguez
a43439dd60 Include deleted channels on get user channels endpoint (#13877) 2020-03-02 22:15:15 +01:00
Mario de Frutos Dieguez
9742a0595d Include Mutex for Hubs property (#13917)
Hubs property has been detected by the race condition detector
as a possible one because we could set the Hubs variable
and also we're spawning goroutines that could ask for that property

This condition is not happening right now because we're setting the
Hubs variable in the server start and after that, we're spawning the
goroutines but the tests are failing because of this and in the future
this could be a problem
2020-03-02 19:37:57 +01:00
Agniva De Sarker
a981099652 Add error checks to TestUnlinkGroupTeam (#13956)
I could not figure out the actual root cause for this.

But a possible area of concern is that somewhere in the call stack,
the login failed partially. Therefore, the session did not have the teamMembers
populated. And the permission check failed therefore.

Adding the error checks should let us know in future if this is not the case.

Another possible case is the app.ClearTeamMembersCache which gets called in
the goroutine app.SyncRolesAndMembership. If this races with the session,
then it's possible that the teamMember is wiped off from the session. But this
happens after the permission check. So it's not very likely.

Also, while we are here, I found that (*app).ClearTeamMembersCache
does not log the internal error bubbled up. This prevents us from understanding
what actually happened. Added that logging.
2020-03-03 00:04:39 +05:30
Jesús Espino
7035e09fe9 Adding changes to separate unit tests and integration tests (#13670)
* Introducing unit (not integration) tests for the app layer

* Initial support for unit tests at the API

* Adding unit tests support to the store layer

* Add unit tests support in commands

* Adding last tests needed for run unit tests properly

* Fixing govet

* Removing some duplication

* Fixing tests

* Fixing tests

* Not compiling test helpers with the main module for api

* Revert "Not compiling test helpers with the main module for api"

This reverts commit 36a199bbe0f7503f665f5d6c7b41c53aabc2e54f.

* Fixing tests

* Fixing unit tests

* More consistency between api4/apiteslib.go and app/helper_test.go

* Renaming things to make more obvious the new Setup functions purpose

* Reverting change in go.sum

* Start with empty mock for app layer

* Start with empty mock for api layer

* Start with empty mock for web layer

* Renaming SetupWithStoreMockConfig to SetupConfigWithStoreMock

* Fixing tests on web package

* Removing unnecesary function
2020-03-02 08:13:39 -08:00
JtheBAB
cd36c9f041 MM-22355 - Fix typos detected by goreportcad.com (#13842)
* Update webhook_test.go

* Update user_test.go

* Update filesstore_test.go

* Update plugin_requests.go

* Update syncables.go

* Update helper.go

* Update html_entities.go

* Update user.go

* Update team.go

* Update notification.go

* Update notification_test.go

* Update plugin_api_test.go

* Update post_metadata.go

* Update channel_test.go

* Update database.go

* Update channel.go

* Update user_store.go

* Update team_test.go

* revert andd

* Revert back to infintie

Co-authored-by: Jesús Espino <jespinog@gmail.com>
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-03-02 17:10:40 +01:00
Mario de Frutos Dieguez
75197d291a Added Websocket's broadcast queue load metrics (#13935)
Now we send metrics when the websocket's broadcast queue receive or
consume a message from the queue
2020-02-28 11:44:56 +01:00
Rajat Varyani
fdb339fbd7 [MM-20941] Parallelize plugin loading on startup (#13617)
* [MM-20941] Parallelize plugin loading on startup

* [MM-20941] Parallelize plugin SyncPlugins

* [MM-20941] Make activation and deactivation of plugin concurrent

* [MM-20941] Remove uncessary optimization

This reverts commit aad2680aec843125bf72d8d2406869f4948dba42.

[MM-20941] Remove uncessary wait in SyncPlugins

[MM-20941] Parallelize processing of prepackaged plugins

* [MM-20941] Fix lint issue

* [MM-20941] Fix bug for getting the number of plugins to process

* [MM-20941] Use buffered channel and fix return issue in prepackaged plugin processing

* [MM-20941] Implement feedback

* [MM-20941] Fix looping over channel for plugins

* [MM-20941] Retain signature of process plugin

* [MM-20941] Fix function documentation

* [MM-20941] Fix bug to pass the plugin path in anonymous function

* [MM-20941] Rename variable

* [MM-20941] Make minor changes in variable naming

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-02-17 18:30:48 -04:00
Eli Yukelzon
53e07a68f5 fixing a screwup (#13906)
Automatic Merge
2020-02-17 03:44:34 -05:00
Jesse Hallam
9a51c73f64 MM-22619: check for nil plugins environment (#13901)
* MM-22619: check for nil plugins environment

Check if plugins were disabled before attempting to collect metrics and emit telemetry for same.

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

* Update app/diagnostics_test.go
2020-02-15 17:46:26 -05:00
Ali Farooq
bd9d674006 Fixing master (#13900)
* updating api_timer_layer_generated.go

* Fixing GetFileInfos

* Fixing TestPluginAPIGetFileInfos

* Remove file.go.orig
2020-02-14 18:08:00 -05:00
Ali Farooq
e4fb5791b0 MM-21626, MM-21627 - Plugin API/Hooks Prometheus instrumentati… (#13825)
* MM-21626,MM-21627 - Plugin API/Hooks Prometheus instrumentation

* Updated einterface mocks

* Fixed supervisor tests

* ignoring golint errors for plugin metrics wrappers

* Making golangci happy

* Using variadic form when generating wrapper code

* Removed artificial delay

* Removed comments from tests

* Renaming plugin wrappers to api/hooks_timer_layer

* updating vendor dir and mod files

* Recording plugin api/hook responses in prometheus

* Updated einterfaces-mocks

* Updating go sum

* Updating go sum

* Fixing conflicts

* More conflicts fixing

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-02-14 15:47:43 -05:00
Ashish Bhate
3fc5287f6b MM-17912: Allow searching for files through plugin API (#13647)
* constants and options for getting files

* Method to get files with options

* Add i18n strings for en

* Add API methods for getting files with options

* gofmt -s file

* explicitly set create at in tests

* use greater than nanosecond time difference for tests

* use gte instead of gt for getting files by created time

* use created at time as default sort order for getting file infos

* use explicit inline strings instead of format strings

* join tables only when required

* use if as secondary sort, and update tests

* update field docs to reflect previous changes

* make page and perPage get options as required

* add json struct tags to GetFileOptions

* bump minimum server versioni

* remove sorting by username and channelname

* use bool for sort order type

* use FileInfo prefix instead of just File

* clearer comments

* use zero-based page numbering

* test filtering by user and channel

* remove unnecessary whitespace

* use int instead of uint for page and perPage arguments

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-02-14 16:21:54 -04:00
Miguel de la Cruz
84f45634a8 Remove remaining t.Fatal from the codebase (#13876)
* Remove remaining t.Fatal from the codebase

* Fix job_store test

* Address review comments

* Remove comments
2020-02-13 17:53:23 +01:00
Eli Yukelzon
17523fa5d9 MM-21898 - Part 1: Generate and use an interface instead of *A… (#13840)
* Generate and use an interface instead of *App
2020-02-13 13:26:58 +01:00
Jesús Espino
66fc096768 MM-22340: Fixing flaky tests around Team name validation (#13875)
* MM-22340: Fixing flaky tests around Team name validation

* Fixing other cases where can happend the flaky tests
2020-02-13 09:36:21 +01:00
Jason Blais
35ac2629e2 Add missing "AutomaticPrepackagedPlugins" to diagnostics.go (#13868) 2020-02-12 17:52:15 -04:00
Farhan Munshi
897715f883 [MM-21919] Add use_channel_mentions permission (#13781)
* MM-21919 Add channel_mention permission

* MM-21919 Fix emojis migration test

* Enforce Channel Mentions on the in the posts api

* MM-21919 Rename permission to use_channel_mentions

Allow posts with channel mentions to still be posted without the permission just don't send notifications to users

* MM-21919 Add tests for a post with @all and @here

* MM-21919 Add use channel mentions to all roles that have create post

* MM-21919 Update app_test to include use_channel_mentions permission in default permissions
2020-02-12 21:15:34 +05:30
Shota Gvinepadze
a7854f1b97 [MM-22037] Enable uppercase letters in the email (#13794)
* Enable uppercase letters in the email

* Lowercase email on every input

* Remove invalid test
2020-02-12 08:51:45 -05:00
Eli Yukelzon
fb4d27d596 MM-22265 - Restrict the WS "update_team" event broadcast (#13848)
Automatic Merge
2020-02-11 03:41:55 -05:00
Maria A Nunez
c6e7030e03 MM-19445 - Fix conditional for plugin version diagnostics (#13844)
* Merge upstream

* Adding plugin version data if no error

* linting

Co-authored-by: Jason Paul Deland <9366595+jaydeland@users.noreply.github.com>
2020-02-10 14:45:19 -05:00
Jesús Espino
1d1ab03c38 Passing t to all tests setup functions (#13841)
* Passing t to all tests setup functions

* Fixing build
2020-02-10 19:31:41 +01:00
Agniva De Sarker
73ce92400b MM-22057: Limit incoming request bodies (#13827)
* MM-22057: Limit incoming request bodies

Set the max request body size to be equal to MaxFileSize.
Ideally, non-file request bodies should be smaller than file request bodies,
but we don't have a clean way to identify all file upload handlers.

There shouldn't be any valid request which exceeds the max file upload size.
So this is a safe global limit to apply.

* Fix tests

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-02-07 14:59:59 -05:00
Martin Kraft
240e57d581 MM-21199: Adds groups diagnostics. (#13736) 2020-02-06 09:25:36 -05:00
Nick Malcev
35102b081e GH-13421 Autoresponder should not reply to bot DMs (#13583) 2020-02-06 12:49:58 +01:00
Andrei Avram
e965d21359 Log error of OnConfigurationChange hook. (#13426) 2020-02-06 07:53:14 +01:00
Eli Yukelzon
597a2b77cd MM-17468 - Improve thread fetching (#13653)
* Revert "Thread fetching revert (#13616)"

This reverts commit 8e0fe90897.

* renamed query param for clarity

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-02-05 13:27:35 +01:00
Agniva De Sarker
435d43049f MM-22049: Add idle timeout to the HTTP server (#13788)
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-02-05 11:32:04 +05:30
Jesse Hallam
918307e4fa delete kv on setting nil (#13769)
Setting a `nil` value should actually delete the row instead of preserve it with a `nil` value.

The existing tests passed because they only checked the return value of `nil`. When running the tests on Postgres, this value is returned as an empty `[]byte{}` instead of `nil`, so update the test to reflect this semantically equivalent behaviour.
2020-01-31 09:58:48 -04:00
Mario de Frutos Dieguez
9de8283077 MM-22067: Check guest email allowance separately (#13776) 2020-01-30 09:25:52 +01:00
Farhan Munshi
fa769e46d7 [MM-21793] Allow bots to be added to group synced channels and teams (#13672)
* MM-21793: Allow bots to be removed and added from group synced teams and channels

* MM-21793: Add tests for adding and removing a team and channel members

* MM-21793 Add punctuation to comments and remove unnecessary variable
2020-01-29 11:01:06 -05:00
Eli Yukelzon
4b39d8487b MM-20977 - Inviting multiple users with valid/allowed and inva… (#13779) 2020-01-29 12:56:59 +02:00
Mario de Frutos Dieguez
682a1d5d15 Avoid panic when push messages are empty or nil (#13751) 2020-01-29 10:08:27 +01:00
Ben Schumacher
cb49d560ab Allow plugins to specify a ReleaseNotesURL via manifest (#13677) 2020-01-28 19:33:21 +01:00
Jesús Espino
5f888bd4fc Making private app/cluster_handlers.go methods (#13760) 2020-01-28 12:06:21 +01:00
Jesús Espino
ae6f15b76f Making private import methos in the app layer (#13758)
* Making private import methos in the app layer

* Making one more method private
2020-01-28 10:58:33 +01:00
Jesús Espino
a76643116f Making private opengraph methods in the app layer (#13759) 2020-01-28 10:56:45 +01:00
Jesse Hallam
9726a917cb MM-21915: improve tar gz path traversal (#13675)
Automatic Merge
2020-01-27 11:33:11 -05:00
Ali Farooq
30061b2285 MM-20865 - Demo Plugin: Enabling and disabling demo plugin generates "connection is shutdown" error (#13604)
Automatic Merge
2020-01-24 09:49:49 -05:00
Jesús Espino
5133fa18f1 Compare config without environment variables to send config updates (#13746) 2020-01-24 08:57:46 +01:00
Marco Kundt
3892db4613 Fix small typo (#13739) 2020-01-23 18:06:57 -05:00
Mario de Frutos Dieguez
0581ff7cb8 User Management > User role change not reflected in the UI without a refresh (#13683) 2020-01-23 19:30:13 +01:00
Allen Lai
90c0479c2f [MM-20804] Add "Unarchive Channel" option to the channel info screen - Additional fixes (#13614)
Automatic Merge
2020-01-23 12:49:48 -05:00
Miguel de la Cruz
eb17f8436f Modifies the interface to add search index metrics and initialises metrics first so it can be used from elasticsearch (#13663) 2020-01-23 17:10:36 +01:00
Jesús Espino
06fb1458ca Use always strings for cache keys (#13631)
* Use always strings for cache keys

* fixing tests

* Addressing PR review comments

* Adding the base to FormatInt

* Fix typo
2020-01-22 15:59:59 +01:00
Hossein Ahmadian-Yazdi
c4ce55f0b7 [MM-21373] Don't send verification (#13637)
* Don't send welcome email if verificaiton is off

* update code to send email but not include verification link

* Update code to not send welcome email if email notifications is off

* update failure clause
2020-01-21 19:44:14 +05:30
Eli Yukelzon
04e6911a6b GH-10438 - Rewrite existing plugin API tests to exclusively te… (#13302) 2020-01-21 10:41:28 +02:00
Maria A Nunez
ebfd332161 MM-21374 - Fixed extracting icon for prepackaged and local plugins (#13633)
* Merge upstream

* Added extracting iconData for prepackaged and local plugins

* Fixed tests

* Removed report.xml

Co-authored-by: Jason Paul Deland <9366595+jaydeland@users.noreply.github.com>
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-01-20 10:34:18 -05:00