Commit Graph

12003 Commits

Author SHA1 Message Date
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
Christopher Speller
45565cb81f Fix CLI nil pointer panic (#13359) 2020-01-06 11:17:19 -08:00
Vladimir Lebedev
5c6bdc357a MM-18384 - Migrate tests from "app/notification_test.go" to use testify (#13526)
* MM-18384 - Migrate tests from "app/notification_test.go" to use testify

* fix golangcibot

* fix golangcibot

* break complex comparisons into multiple simple statements

* make test cleaner

* add missing changes
2020-01-06 14:15:12 -05:00
Agniva De Sarker
88fecdb1a3 MM-21396: fix duplicate channel cluster invalidations (#13537)
While invalidating a channel, we send out a cluster message
from the app layer as well as from the localcachelayer.

This causes multiple redundant messages to be sent out.

And additionally multiple cluster handlers were being registered
from the app layer as well as the localcachelayer.

We fix this by removing the cluster broadcast from the app layer
and directly calling the store method. We also remove
the duplicate event handler registration.
2020-01-06 23:07:08 +05:30
Rajat Varyani
e27969adbc [MM-12374] Add CLI command for moving outgoing webhook (#12538) 2020-01-06 10:58:56 +01:00
Claudio Costa
c89d1435ab Use ApiTrustRequester for SAML complete endpoint (#13562) 2020-01-06 09:38:17 +01:00
Agniva De Sarker
e826055519 MM-21336: Improve channel rename restrictions (#13441)
* MM-21336: Improve channel rename restrictions

Non-direct channels should not have __ in them.

* Fix order of i18n extraction

* Incorporate review comments

Use a more relaxed check by actually checking for valid userIds.

* Improve error message
2020-01-03 20:56:32 +05:30
Shota Gvinepadze
69ab1ea1e4 [MM-20029] Fix incorrect bot message (#13392)
* Fix incorect bot message

* Edit whitespace
2020-01-03 18:31:13 +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
Claudio Costa
7a6c0f607b [MM-21359] Add extra permission check when updating an OAuth app (#13445)
* Add permission check

* Add additional check in tests
2020-01-02 20:56:09 +01:00
Agniva De Sarker
f75c8c7c9f MM-20225: Fix notification badge count for All Activity (#13353)
When push notification setting was selected to "All Activity", we were
just sending the unread count for the channel from where the message was sent
and not for all channels.

After discussion with @enahum and @migbot, we decided to keep the badge count
to only refer to mentions and not unread posts.

Therefore, we only take the unread count for the user irrespective of the
notify_props settings.

Updated the tests to reflect that.

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2020-01-01 13:46:51 +05:30
Elisabeth Kulzer
abfd8fcc02 Add triggering enterprise tests. (#13541) 2019-12-30 17:29:10 -05:00
Joram Wilander
23eebcf0d7 Fix Bots table lacking schema migration (#13542) 2019-12-30 09:33:27 -08:00
Agniva De Sarker
1e28ad4a73 MM-21209: Use the LRU cache for UserStore.Get call too (#13456)
* MM-21209: Use the LRU cache for UserStore.Get call too

We already have userProfileByIdsCache to store the user profiles by Id.
It just wasn't being used for the (*UserStore).Get method. We add a wrapper
method in LocalCacheUserStore to intercept that call and check for the
presence of the user Id in the cache.

There is no need to add any code for invalidation as all of that is already
present.

* Fix nil check for rootstore

* Fix TestUserStore test

Added an invalidate call. The invalidation was being done
from the app level. Hence we have to do it manually here for the test.
2019-12-30 09:22:31 -08: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
Claudio Costa
9ab7bee0a6 Return http.StatusNotFound error when trying to get a channel by name without permissions (#13443) 2019-12-23 21:46:52 +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
Christopher Speller
fdd1ae974f Fix encoding on configuration tables. (#13296) 2019-12-20 15:31:03 -08:00
catalintomai
e48d093d01 MM-19877: Remove references to PermanentDeleteBatch from audit store (#13393)
* MM-19877: Remove references to PermanentDeleteBatch from audit store
2019-12-20 15:37:01 +00:00
Jesús Espino
68e0b1fdc2 Enforces structured logging in enterprise code (#13444) 2019-12-20 15:18:59 +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
Miguel de la Cruz
f41c90657e Remove bad update user email example (#13356) 2019-12-20 04:37:45 -08:00
Agniva De Sarker
c9cd14b50b MM-21331: Add aggregate cache metrics for channelByNameCache (#13440)
The `channelByNameCache` in the `GetByNames` query checks each teamId+channelName
combination in the cache and if any of the keys is not present, it queries the DB.

In this case, this is effectively a cache miss from the point of view of user.
But since the cache is at a teamId+channelName level, there may be several hits and some misses.
This is misleading as it does not generate proper metrics and might lead to a
false assumption of how effective the cache is.

We create separate metrics which account for all or none cache hits/misses.
This removes the old metrics which are used by other queries. So they are now separated,
and it will improve both the old and new metric. Because the old metric is not contaminated,
and the new metric is also separate.
2019-12-20 17:04:19 +05:30
Vladimir Lebedev
e4481aae21 MM-20104 -Migrate channelCache cache from store/sqlstore/channel_store.go to th… (#13254)
* Migrate channelCache cache from store/sqlstore/channel_store.go to the new store/localcachelayer

* fix import for new path

* remove unnecessary code, refactor cache constant

* resolve conflicts

* fix missing variable and import after merging

* refactor code, fix current issue

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
2019-12-20 13:34:58 +05:30
Vladimir Lebedev
722924b910 MM-19508 Extend ShouldProcessMessage to filter out from_webhoo… (#13270)
Extend ShouldProcessMessage to filter out from_webhook posts
2019-12-19 20:52:41 +01:00
Claudio Costa
7274f4c6c2 [MM-21020] Return same error when creating a duplicate channel (#13429)
* Return same error when trying to create a channel with the same name of an existing one

* Remove unused arguments
2019-12-19 18:50:20 +01:00
Jesús Espino
fc9d49b2d2 MM-21254: Removing unnused/unnecesary getClientLicense etag (#13416) 2019-12-19 17:00:15 +01:00
Scott Bishel
3bccc03df3 MM-19872: Update dependencies for enterprise implementation of new SAML2 golib. (#13298)
* Update dependencies for enterprise implementation of new SAML2 golib.

* add indirect
2019-12-19 08:27:34 -07:00
Hossein Ahmadian-Yazdi
155ada09fb [MM-10858] Channel Member Update Websocket Event (#13305)
* Channel Member update event

* Address PR comments and extend tests

* golang ci addressed

* Update api4/channel_test.go

Co-Authored-By: Ben Schumacher <ben.schumacher@mattermost.com>
2019-12-19 08:53:29 -05: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
Martin Kraft
75ffd0b69e MM-14675: Eliminates implicit GroupChannel/GroupTeam associations. (#13199)
* MM-14675: Upserts GroupTeam when GroupChannel is linked.
MM-14675: Delete all associated GroupChannels when deleting a GroupTeam.
MM-14675: Using replica DB where possible.
MM-14675: Updates create method used in tests.

* MM-14675: Removes unnecessary DB retrieval of GroupSyncable record.
2019-12-18 08:54:09 -05:00
Sanele T. Mahlalela
0ffe199928 A bit of cleanup in localcachelayer test descriptions (#13283) 2019-12-18 14:10:00 +01:00
Johannes Tigges
e43b404579 GH-13376: Improve community server links and phrasing in READM… (#13379)
Improve community server links and phrasing in README.md to be more inviting and accurate.

Fixes #13376
2019-12-18 12:14:53 +01:00
Agniva De Sarker
0e6f0cfbd6 MM-21118: Use querybuilder instead of fmt.Sprintf in channelStore (#13385)
* MM-21118: Use querybuilder instead of fmt.Sprintf in channelStore

We use the querybuilder API instead of just building the query string
manually using fmt.Sprintf

* Replaced comma with colon
2019-12-17 18:03:38 +01:00
Hossein Ahmadian-Yazdi
de0672937c [MM-19422] Add SQL trace and LDAP trace output to both console and server logs (#13190)
* Add MLOG for sql store

* Update printf function

* Update store/sqlstore/supplier.go

Co-Authored-By: Martin Kraft <martin@upspin.org>

* Update go mod

* update go mod and tidy it up

* update vendor folder
2019-12-17 09:47:09 -05:00
Agniva De Sarker
a83df931b9 Replace pipe with redirection to a subshell (#13409)
When the writing process sends an EAGAIN to the fd, tee dies.
We correct this behavior by redirecting the output to a subshell
which handles this correctly.

Relevant link here: https://serverfault.com/questions/369757/why-is-this-tee-losing-stdout
2019-12-17 14:58:25 +01: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
Jesús Espino
b8ef62e502 Adding structuredLogging check and fix inconsistencies (#13370)
* Adding structuredLogging check and fix inconsistencies

* Addressing PR review comments

* Addressing PR review comments

* Addressing PR review comments

* Addressing PR review comments

* Addressing PR review comments
2019-12-16 13:57:21 +01:00
Jesús Espino
fd0a3a687d Exposing named error from zap api on our mlog api (#13395) 2019-12-15 13:54:50 +01:00
Claudio Costa
2b7916e08f [MM-21119] Update config files permissions (#13386)
* Update config files permissions

* Add error check

* Update permissions for persist
2019-12-13 19:53:42 +01:00
Claudio Costa
c06b2d28c3 Disallow changing type when updating a channel (#13387) 2019-12-13 18:12:47 +01:00
Agniva De Sarker
e2e2ad48ce Add -trimpath flag to the builds (#13348)
Go 1.13 introduced this new flag which removes all absolute file system paths
from the binary and just keeps the module path / GOPATH. To debug binary
crashes or stack traces, we only need the path to the code and not the full
file path. Hence this is a quick way to reduce the binary size without any information
loss.

Shaves off around 750KB from the server binary.
2019-12-13 14:12:28 +01:00
Jesse Hallam
89c0b61bc3 MM-21103: change plugin signature path (#13360)
* MM-21103: change plugin signature path

Save as `<plugin_id>.tar.gz.sig` instead of `<plugin_id>.sig`. The latter was a relic of the previous design to support multiple plugin signatures, but now creates an inconsistency with how the original source files were supplied as `<some_name>.tar.gz` and `<some_name>.tar.gz.sig`.

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

* relax signature matches to avoid assuming signatures always exist
2019-12-12 13:45:55 -04:00
Agniva De Sarker
7d499d2750 MM-21116: Improve channelSearch SQL query generation (#13371)
* MM-21116: Improve channelSearch SQL query generation

The likeTerm from buildFulltextClause was being built inefficient using strings.
We change it to use squirrel to build the query.

And while at it, we also change the len check with checking with
an empty string which is more idiomatic. Both compile to the same
code, so there is no difference performance wise.

* Use a better variable name
2019-12-12 23:13:33 +05:30
Eli Yukelzon
4d3f7ae06c Revert "fix npm ci step" (#13378)
Automatic Merge
2019-12-12 09:49:18 -05:00
Jason Blais
6e275d0866 Add missing diagnostics for 5.18 release (#13358)
@hahmadia https://github.com/mattermost/mattermost-server/pull/13018
@sbishel https://github.com/mattermost/mattermost-server/pull/12362
@ali-farooq0 https://github.com/mattermost/mattermost-server/pull/13017
2019-12-12 09:17:31 -05:00