Commit Graph

1580 Commits

Author SHA1 Message Date
Shobhit Gupta
7d99d8fba7 Add IsValid method to *Manifest struct (#13609) 2020-01-17 21:08:55 +01:00
Someone
566f28be0a GH-12702 v2: Add new command response parameter: "skip_slack_p… (#13420)
Add new command response parameter: "skip_slack_parsing". Skips Slack magic if set to "true". (#12702)
2020-01-17 08:34:11 +01:00
Agniva De Sarker
2a28edcd93 MM-21481: Fixed several issues from user marshalling (#13627)
* MM-21481: Fixed several issues from user marshalling

- Fixed the root cause for panic by properly converting
the map to a User struct.
- Added a check for type conversion for extra safety.
- Fixed a somewhat unrelated issue of a pointer to pointer reference.

* Fix tests
2020-01-16 09:18:08 +01:00
Maria A Nunez
87eb7697f9 MM-19606- Rework Prepackaged Plugins (#13449)
* MM-19609 - Add new prepackage configuration settings (#13062)

* Add signatures to the prepackaged plugins (#13138)

* MM-19612 - Support querying local plugin marketplace when upst… (#13250)

* MM-19612 - Support querying local plugin marketplace when upstream unavailable or disabled

* Update translations file

* Fixed comment

* Updated to check EnableRemoteMarketplace setting and LocalOnly to get marketplace plugins

* Fixed unit tests

* Tests cleanup code

* Removed unused error message

* Updated tests

* MM-19614- Updated Marketplace Service error id (#13388)

* [MM-19610] Consume prepackaged plugins (#13005)

* consume prepackaged plugins into memory

* missing i18n

* remove spurious .gitignore changes

* return on failure to install prepackged plugins

* cleanup

* s/plugins/availablePlugins

* whitespace

* don't return extractDir when not needed

* s/plug/plugin

* error on icon, cleanup

* update armored version of testplugin signature

* honour AutomaticPrepackagedPlugins

* document getPrepackagedPlugin

* MM-19613 - Include prepackaged plugins in marketplace results (#13433)

* Added prepackaged plugins to marketplace results

* PR Feedback

* PR Feedback

* Update error where definition

* Removing unnecessary var declaration

* Updated comments

* MM-21263 - Use EnableRemoteMarketplace in marketplace install… (#13438)

* MM-21263 - Use EnableRemoteMarketplace in marketplace install endpoint

* Call updateConfig before calling NewServer in TestHelper

* Added translations

* PR feedback

* Translations

* Feedback

* s/helpers.go/download.go

* Converging env.PrepackagedPlugins

* Initial PR feedback

* Ordered imports properly

* Updated DownloadURL to return slice of bytes

* Fixed method typo

* Fixed logging

* Added read lock for prepackaged plugins list

* PR Feedback

* Added condition to only install prepackaged plugin if it was previously enabled

* Linting

* Updated to check plugin state in config

* Closing filereader

* Only add local label if remote marketplace is enabled

* Updated local tag description

* Fixed tests

Co-authored-by: Ali Farooq <ali.farooq0@pm.me>
Co-authored-by: Shota Gvinepadze <wineson@gmail.com>
Co-authored-by: Jesse Hallam <jesse.hallam@gmail.com>
Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
2020-01-15 13:38:55 -05:00
Eli Yukelzon
8e0fe90897 Thread fetching revert (#13616)
* Revert "MM-19371 - Reply count disappears from pinned and flagged conv… (#12753)"
2020-01-15 17:14:04 +02:00
Scott Bishel
70a7ad2969 add additional reserved team name (#13606)
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-01-14 14:39:05 -07:00
Eli Yukelzon
e77ef9733c MM-20977 - Inviting multiple users with valid/allowed and inva… (#13372) 2020-01-14 15:29:50 +02:00
Rajat Varyani
51a61f6bc1 [MM-19720] Expose endpoint for config patch (#12997) 2020-01-14 13:06:17 +01:00
Ben Schumacher
1f3f8fbf57 [MM-21123] Add Labels to upstream Marketplace response (#13425)
* Add Labels to upstream Marketplace response

* Add LOCAL label to local plugins
2020-01-14 07:16:36 +01:00
Vladimir Lebedev
ed555faa75 MM-19137 - Migrate tests from "model/post_test.go" to use test… (#13521)
* MM-19137 - Migrate tests from "model/post_test.go" to use testify

* revert go.sum file

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-01-13 15:07:41 -05:00
Hossein Ahmadian-Yazdi
dc24c9abe8 [MM-20061] Add System Admin filter to both LDAP and SAML (#13534)
* promote user to admin upon login

* Add SAML support for admin accounts

* update en.json

* update i18n

* Add tests as per comments

* change function name

* fix config.go

* invalidate cache so its not checking for cache when roles change

* add enable attribute and filter
2020-01-13 12:50:01 -05:00
Agniva De Sarker
0361e8b97e MM-21210: Add LRU cache for ChannelStore.GetMembersForUser (#13593)
Automatic Merge
2020-01-13 10:46:51 -05:00
Eli Yukelzon
49308e9163 MM-21229 - Customization > Site Name help text doesn't match text field behavior (#13540)
Automatic Merge
2020-01-13 05:46:51 -05:00
larkox
d4935fb22f [GH-13073] Migrate profilesInChannelCache cache from store/sqlstore/user_store.go to the new store/localcachelayer (#13536)
* Migrate profilesInChannelCache cache from store/sqlstore/user_store.go to the new store/localcachelayer

* Fix lint errors

* Remove unneeded cluster messages

* Remove unneeded cluster message registering

* Fix cluster messages

* Correct mistake with messages and restore model message
2020-01-11 17:52:44 +01:00
Martin Kraft
605040c597 MM-20644: Add users to teams as a SchemeAdmin based on a new configuration field on GroupTeams and GroupChannels records. (#13361)
* MM-20644: Add users to teams as a SchemeAdmin based on a new configuration field on GroupTeams and GroupChannels records.

* MM-20644: Adds SchemeAdmin to mapping of the GroupSyncable struct fields.

* MM-2064: Adds test to ensure SchemeAdmin field value is mapped.

* MM-20644: Adds missing index creation for fresh DBs.

* MM-20644: Duplicates UpdateMembersRole across Team and Channel stores. Adds tests.

* MM-20644: Fixes some old method name references.

* MM-20644: Moves variable declaration; removes Println statement.

* MM-20644: Use a SQL query instead of two to update Team and Channel members.

* MM-20644: Fixes tests; updates query.

* MM-20644: Fix permission check for patching a group syncable.

* MM-20644: Fixes test for change of permissions verification in group patch API request.

* MM-20644: Fix for ORM select vs insert.

* MM-20644: Linting fixes.

* MM-20644: Fixes some tests.

* MM-20644: Skips changing the role of guests.

* MM-20644: Added syncableID filtering
2020-01-10 09:19:39 -08:00
Vladimir Lebedev
a2e2b6d9b8 MM-19274 - Migrate tests from "model/config_test.go" to use testify (#13522) 2020-01-10 11:52:00 +01:00
catalintomai
37ce413b7d MM-20698: Add server support for getting SAML metadata and updating S… (#13311)
* MM-20698: Add server support for getting SAMl metadata and updating SAMl settings
2020-01-09 21:25:20 -08:00
Allen Lai
1909fd6607 [MM-20804] Add "Unarchive Channel" option to the channel info screen (#13349)
* add websocket hooks to restoreChannel

* add userId to call in api4

* add constant

* undo changes in en.json

* add constants to en.json

* delete  code for deleting webhooks

* Update i18n/en.json

Co-Authored-By: Ben Schumacher <ben.schumacher@mattermost.com>

* restore channel ordering

* delete Props

* Update app/channel.go

Co-Authored-By: Ben Schumacher <ben.schumacher@mattermost.com>

* Update app/channel.go

Co-Authored-By: Ben Schumacher <ben.schumacher@mattermost.com>

* change message format

* move WS message right after invalidate

* manually reorder en.json entry

* reorder en.json

* undelete to restore

* update en.json ordering

* update wording

* Update model/post.go

Co-Authored-By: Saturnino Abril <saturnino.abril@gmail.com>

* Update model/websocket_message.go

Co-Authored-By: Saturnino Abril <saturnino.abril@gmail.com>

* gofmt

* undeleted to restored

* add test to success case

* delete repeated test

Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
Co-authored-by: Saturnino Abril <saturnino.abril@gmail.com>
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-01-09 09:42:29 +01:00
Jesús Espino
092e53ace2 Fix inconsistencies in variable names for struct methods (#13561) 2020-01-07 10:47:03 +01:00
Ibrahim Serdar Acikgoz
d8ac09b302 Gh 10166 (#13021)
* model/config: add required server config field to manifest

* plugin/helpers: add check required server configuration method

* plugin/helpers: code polish

* model/manifest: add documentation

* Update plugin/helpers_config.go

Co-Authored-By: Ben Schumacher <ben.schumacher@mattermost.com>

* plugin/helpers_config: remove stagnant line

* plugin/helpers: update to v5

* plugin/helpers_config: add license

Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
Co-authored-by: Jesse Hallam <jesse.hallam@gmail.com>
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-01-06 17:08:24 -04:00
Miguel de la Cruz
c3c250cd91 [MM-16798] Add a Guest Accounts feature flag (#13231)
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-01-02 22:15:10 +01:00
Renil Joseph
803a58f991 [MM-17422] Added code to update, delete last bot_icon time in model.bot. (#12229)
Display LHS bot Icon in web app. As part of mentioned task, Added LastIconUpdate variable in model.bot to store last update time of icon. Also added code to update/delete value of the mentioned variable when setting/deleting bot icon.
2019-12-29 15:30:18 +01:00
Martin Kraft
f8d31def8e MM-21290: Adds licensing feature for LockTeammateNameDisplay. (#13431) 2019-12-27 17:24:34 -05:00
Agniva De Sarker
f2a14ae976 Added some godocs to a few websocket related structs (#13451)
* Added some godocs to a few websocket related structs

* Incoporate review comments

* Fix more review comments
2019-12-24 08:51:03 -05:00
Claudio Costa
80dd2915db [MM-19914] Fix data races in WebSocketEvent (#13039)
* Make WebSocketEvent type immutable

* Update code to use updated immutable WebSocketEvent type

* Export WebSocketEvent fields and mark them as deprecated
2019-12-24 09:32:11 +01:00
Jesús Espino
b3e49ec45c Use require/assert.Empty instead of require/assert.Len(t, X, 0) (#13413) 2019-12-22 12:35:31 +01:00
Sanele T. Mahlalela
de9a0197e2 [GH-13074] Migrate TermsOfServiceCache from store/sqlstore/terms_of_service.go to the new store/localcachelayer (#13205)
* migrated termsOfServiceCache from sqlstore to localcachelayer, and mocked store tests

* revert gitignore local change

* fixed caching in termsOfService Get, and added basic tests for termsOfServiceCache

* added a test for cache save, and fixed call to Store tests

* fixed GeLatest termsOfService from cache test

* added license headers to terms_of_service cache files

* using doStandardReadFromCache and doStandardAddToCache when reading and writing to cache

* removed unused variable, termsOfServiceCacheName

* added special key for the latest termsOfService value in termsOfServiceCache

* updated license information on localcachelayer termsOfServiceCache files

* fixed not updating latest termsOfServiceCache on Get by ID, and invalidating cache cluster on termsOfServiceCache save

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2019-12-20 13:51:54 +01:00
Scott Bishel
be3e008dca MM-19867: - Implement allowing multiple SAML Libraries (#13299)
* Implement allowing multiple SAML Libraries

* fix unit tests

* updates based on review feedback

* Only set on startup, not config changes

* update unit tests, reload enterprise

* need to reset for previous tests

* update license statement

* fix licensing line
2019-12-18 15:35:53 -07:00
Jesús Espino
4cbea3d5b5 Use require.Len instead of require.Equal for length checks in model/search_params_test.go (#13410)
* Use require.Len instead of require.Equal for length checks in model/search_params_test.go

* Using require.Empty instead of require.Len(t, X, 0)
2019-12-17 12:12:38 +01:00
larkox
d8f5b2a4da [GH-13099] Migrate lastPostTimeCache cache from store/sqlstore/post_store.go to the new store/localcachelayer (#13134)
Automatic Merge
2019-12-11 06:42:00 -05:00
Ben Schumacher
354f20e7f0 Bump app version to 5.20 (#13230) 2019-12-10 13:17:06 +01:00
Jason Frerich
876cf82bad [MM-14725] Inform System Admins when a user who managed bot ac… (#11669)
* Add notification, to sysadmins, when a user is disabled and the user
owns bots.

* If the user doesn't have any bots, there is no need to send a
notifcation to sysadmins

* Remove comment

* Update documention link

* Send as System

* Query teams for each sysadmin and add first response to hardcoded link.

* Remove fmt.print debug statements

* remove link with hard-coded team.  Will add this as future enhancement
Expose GetDisableBotSysadminMessage function so it can be tested
Add test new function for testing new notification feature

* Fix shadow error

* Swap sentences in the message when  System Console > Bot Accounts > Disable bot accounts when owner is deactivated: is set to false

* Another message correction

* Rename Custom Integrations to Integrations

* rename botsDisabled variable to disableBotsSetting

* - increase the number of bots and sysadmins queried to 1000.
- limit the number of bots printed in the post to 10, but mention the
  total bots owned by the user

* Enable translations for sysadmin messages

* - Rename function. The actual purpose for the function is to notify
  sysadmins that a user, that owned bots, was disabled.
- convert GetDisableBotSysadminMessage from a function to a method.
  This allows getting *a.Config().ServiceSettings.DisableBotsWhenOwnerIsDeactivated
  in the method and avoids having to pass the value as an input to a
  function

* fix "make i18n-extract" error.  Reorganize .json file

* Correct the upper range value to be the minimum of number of elements in the
userBots array, or the upper limit (10)

* replace t.fatal with require statements
fix golangci-lint errors

* Create separate message when user managed less than or fewer than 10 bots
Test cases for both message types

* fix i18n sorting

* Using pagination to get the bots and sysadmins instead of setting
arbitrary value for PerPage and only retrieving first page

* only use one translation ID for the message.
push all logic into the template so translators can view the logic
add disableBotsSetting and printAllBots variables to the translation
map

* Break the for loop once len(bots) < perPage value, instead of
breaking once there are no bots. This saves one additional call
2019-12-06 20:00:47 -06:00
Christopher Poile
6e6a44764c [MM-19892] Fix failing test TestImportBulkImport (#13003)
Automatic Merge
2019-12-04 11:31:52 -05:00
Harrison Healey
4a23d4b282 MM-20681 Fix custom post types not marking channel unread when using Mark as Unread (#13247)
* MM-20681 Fix custom post types not marking channel unread when using Mark as Unread

* Fix inverted if statements
2019-12-03 14:51:50 -05:00
Doug Lauder
420c411595 MM-8607: Add ability to turn off non-critical services when under load; cluster support (#13267)
* MM-8607: Add cluster support for server busy status

MM-8607: Busy.Cluster should be non-exported

MM-8607: rename logging field seconds -> expires_sec

MM-8607: each node clears its own busy flag

MM-8607: ensure unit tests are not sensitive to test machine speed

* MM-8607: chg comment to force CI rebuild
2019-12-03 18:56:39 +01:00
Maria A Nunez
4ebc71ed38 MM-18089 - Custom setting type manifest documentation (#13306)
* Added custom type to manifest setting types documentation

* Update text

* Typo PR Feedback
2019-12-03 12:52:16 -05:00
Ben Schumacher
d0d6ce0a70 [MM-20353] Change KVSetWithOptions to accept a byte slice (#13213)
* Drop EncodeJSON from PluginKVSetOptions

* Add unit tests for KVSetWithOptions with nil values
2019-12-03 10:46:15 +01:00
Jesús Espino
a63684fcb5 Consistent license message for all the go files (#13235)
* Consistent license message for all the go files

* Fixing the last set of unconsistencies with the license headers

* Addressing PR review comments

* Fixing busy.go and busy_test.go license header
2019-11-29 12:59:40 +01:00
Rodrigo Villablanca Vásquez
e03411795c Migrating team store cache to cache layer (#13075)
Automatic Merge
2019-11-29 05:56:50 -05:00
larkox
d2e78e28a9 [GH-13105] Migrate channelPinnedPostCountsCache cache from store/sqlstore/channel_store.go to the new store/localcachelayer (#13164)
* Migrate channelPinnedPostCountsCache cache from store/sqlstore/channel_store.go to the new store/localcachelayer

* Remove GetPinnedPostCountFromCache

* Rearrange test to avoid undeclared variable
2019-11-28 15:21:42 -05:00
Miguel de la Cruz
2259b7f2a8 [MM-19948] Set version on module file and internal paths (#13186)
* [MM-19948] Set version on module file and internal paths

* Fixes after merge

* Fix i18n checker error
2019-11-28 14:39:38 +01:00
Martin Kraft
14bcd1f0a1 MM-18357: Adds pagination to team search. (#12910)
* MM-18357: Adds pagination to team search.

* MM-18357: Adds new client method for paginated requests.

* MM-18357: Adds feedback about non-supported pagination-permissions combo.

* MM-18357: Removes unnecessary conversion.

* MM-18357: Removes paginate parameter and uses nil on page and perpage instead.
2019-11-28 08:11:02 -05:00
Doug Lauder
5abbe50258 MM-8607 Add ability to turn off non-critical services when under load (#13212)
* MM-8607: add ability to turn off non-critical services under load

* server busy invalid param unit tests

* MM-8607: rename server busy endpoints

* MM-8607: handle case where App not initialized

* MM-8607: additional unit test cases per feedback.

* MM-8607: use decorator to check isbusy when adding endpoint route

* MM-8607: rename endpoints, use struct for json

* Update api4/system.go

Fix misspelled log output

Co-Authored-By: Saturnino Abril <saturnino.abril@gmail.com>

* MM-8607: fix i18n order; max seconds for server busy expiry
2019-11-27 20:41:09 -05:00
Allen Lai
fdec1ef1f5 MM-20100: Migrate channelGuestCountsCache cache from store/sqlstore/channel_store.go to the new store/localcachelayer (#13135)
* init

* migrate

* add test

* fix channel store

* ...

* missing ')'

* change function interface

* fix build

* fix format

* Update store/localcachelayer/layer.go

Co-Authored-By: Bot from GolangCI <42910462+golangcibot@users.noreply.github.com>

* Update store/localcachelayer/channel_guest_layer_test.go

Co-Authored-By: Bot from GolangCI <42910462+golangcibot@users.noreply.github.com>

* im so confused why my builds are failing

* fix build

* format

* fix format

* add license header

* resolve some conflicts

* add test

* fix constant names

* fix more constants

* fix bugs

* delete unused constants

* Update store/localcachelayer/channel_layer.go

Co-Authored-By: Bot from GolangCI <42910462+golangcibot@users.noreply.github.com>

* typo

* another typo

* get guest

* change test

* go fmt format

* change test

* remove getcountcache

* delete method from interface

* delete method

* update test

* rerun GoLang CI
2019-11-27 09:14:40 -05:00
Rodrigo Villablanca Vásquez
27375cd081 Migrate profileByIdsCache cache to cache layer (#13133)
* Partial advances

* Small advances

* invalidating cache with doInvalidateCacheCluster

* Renamed cache

* Starting with tests (failing by now)

* Passing tests :)

* Passing tests

* Fix ineffectual assignment in tests

* Revert of backward incompatible change

* Removed unused var
2019-11-25 21:18:01 +01:00
larkox
22b495b2df [GH-13058] Migrate webhookCache from store/sqlstore/webhook_st… (#13091)
* Migrate webhookCache from store/sqlstore/webhook_store.go to the new store/localcachelayer

* Remove duplicated statistics and move several functions to the layer

* Put cache size in format minutes * 60seconds

* Move cache functions to layer functions over the caches

* Directly remove and purge caches in handleClusterInvalidate to avoid loops
2019-11-25 20:44:52 +01:00
Elias Nahum
3e9cd464de MM-20347 Move ID Loaded Push Notifications to E20 (#13185)
* Move ID Loaded Push Notifications to E20

* Fix model tests
2019-11-21 19:35:19 -03:00
Rodrigo Villablanca Vásquez
3a8fb53f3e Migrates the lastPostsCache from PostStore into cache layer (#13141)
* Some advances

* Partial advances

* Cache moved

* Tests finished

* Removed all test for PostStore (store/sqlstore) related with Cache. This is tested in the cache layer now
2019-11-20 15:03:08 +01:00
Martin Kraft
0212845385 MM-18356: Adds ability to paginate channel search. (#12830)
* MM-18356: Adds ability to paginate channel search.

* MM-18356: Minor refactor.

* MM-18356: Adds doc.

* MM-18356: Fixes doc.

* MM-18356: Some commentary, adds the total count to non-paginated responses, and removes a stray fmt.

* MM-18356: Fixes shadowed variable.

* MM-18356: Removes paginate field and API parameter.

* MM-18356: Adds method to check if channel search is a paginated request.

* MM-18356: Vet fix.
2019-11-19 11:38:49 -05:00
Harrison Healey
de913e7537 Merge branch 'master' into mark-as-unread 2019-11-19 09:45:03 -05:00