Commit Graph

11962 Commits

Author SHA1 Message Date
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
Claudio Costa
acb19f640b [MM-21115] Add permissions check on user_typing event (#13373)
* Add permissions check on user_typing event

* Fix test
2019-12-11 20:18:36 +01:00
Claudio Costa
637d9e0ea6 Add CSRF check for handlers that do not require a session but have one (#13354) 2019-12-11 07:56:53 -08:00
Eli Yukelzon
f672eb7291 corrected file permissions for localstore (#13369)
Automatic Merge
2019-12-11 09:42:00 -05:00
Agniva De Sarker
bc496a0d96 Add the old fmt and vet targets to legacy.mk (#13202)
* Add the old fmt and vet targets to legacy.mk

This is to ease the transition until a time
when everybody has moved to using golangci-lint.

* Just run golangci-lint for make vet
2019-12-11 17:13:43 +05:30
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
Jesse Hallam
bb1facb1f5 MM-20755: fix post actions in DMs/GMs (#13248)
* MM-20755: fix post actions in DMs/GMs

The fix for https://github.com/mattermost/mattermost-server/issues/12377 assumed that all channels have teams, but this is false for DMs and GMs.  Test for this and avoid failing on a missing team as such.

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

* tweak code for clarity
2019-12-10 12:57:54 -04:00
Ben Schumacher
354f20e7f0 Bump app version to 5.20 (#13230) 2019-12-10 13:17:06 +01:00
Jesús Espino
f55a81163e Adding mattermost-govet to the pipeline (#13257)
* Adding mattermost-govet to the pipeline

* Trying to fix circleCI config

* Trying to fix circleCI config

* Trying to fix circleCI config

* Trying to fix circleCI config

* Update Makefile

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

* Update Makefile

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

* Addressing PR review comments

* Addressing PR review comments

* Addressing PR review comments

* Addressing PR review comments

* Addressing PR review comments

* Addressing PR review comments

* Adding legacy check-licenses task to legacy.mk

* Removing unnecesary GO111MODULE=off lines

* Adding jenkins mattermost-govet installation
2019-12-10 13:10:35 +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
Jesse Hallam
345b0c560a MM-20948: nocache for static plugin assets (#13322)
Serve static plugin assets with a `Cache-Control: no-cache, public` header. This avoids caching a 404 response for such an asset, preventing it from being loaded until expiry even if the file later becomes available.

This is currently preventing updates of plugins on community and would generally affect any customer with a cache in front of the Mattermost servers.

Fixes: https://mattermost.atlassian.net/browse/MM-20948
2019-12-05 23:57:30 -04:00
Carlos Tadeu Panato Junior
d3a1a37f93 upgrade DB to 5.18 (#13315) 2019-12-05 23:06:50 +01:00
Ali Farooq
186524bba4 Revert "MM-20105: Migrate channelByNameCache cache from store/sqlstore/channel_store.go to the new store/localcachelayer (#13189)" (#13329)
Automatic Merge
2019-12-05 16:15:07 -05:00
Jesús Espino
0d735042d9 Fixing flaky test around websocket counts in analytics API endpoint (#13314) 2019-12-05 22:06:15 +01:00
Shota Gvinepadze
9898f91f7e [MM-20309] production public key (#13244)
* Add production public key

* Fix unit tests
2019-12-05 23:41:52 +04:00
Ben Schumacher
5122b9e292 [MM-20723] Add golint for plugin package to golangci (#13090) 2019-12-05 20:31:53 +01:00
Carlos Tadeu Panato Junior
d12bf77f53 dont build master or release branches (#13310)
those branches are being built in the internal jenkins
2019-12-05 17:05:52 +01:00
Mario de Frutos Dieguez
8347f3e1fa Bulk import/export supports direct messages from a user to themselves (#13200)
* Test added to check support for import of messages sent to your own DM
channel

* Support for single member direct channel messages and posts

Now bulk import is able to export/import the self direct channel and
the posts inside

* Improve how the copy of channel members for DM and DM posts

* Improved the tests for the export self-channels
2019-12-05 22:58:38 +08:00
Farhan Munshi
8cafd11162 [MM-20620] Handle trailing slash when building marketplace api… (#13273) 2019-12-04 17:55:53 +01:00
Christopher Poile
6e6a44764c [MM-19892] Fix failing test TestImportBulkImport (#13003)
Automatic Merge
2019-12-04 11:31:52 -05:00
Claudio Costa
72f3bb10c7 [MM-20761] Fix and improve integrity check tool (#13246)
* Fix query and add tests

* Support NULL values and improve output
2019-12-04 16:56:08 +01:00
Igor Gomonov
dc610d201d GH-12781: Migrate tests to use testify (#13203) 2019-12-04 16:49:06 +01:00
Agniva De Sarker
5a4ac4b249 Fix typo for v5 module path (#13313)
The PR link uses the github repo path, not the module path.
2019-12-04 10:59:11 +01:00
Allen Lai
223db0c05c MM-20105: Migrate channelByNameCache cache from store/sqlstore/channel_store.go to the new store/localcachelayer (#13189)
* migrate

* add unit test

* change syntax

* delete comments

* remove includedeleted search method

* remove include search method in correct file

* change constant

* add Mock.On

* change to &channel

* fix type for Mock.on().return()

* remove inc counter

* suggestions takened

* get rid of unneeded concat

* go fmt

* import v5
2019-12-04 06:55:02 +01: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
Agniva De Sarker
df95748e86 Remove references of GOPATH from circleCI config (#13263)
* Remove references of GOPATH from circleCI config

And normalize all paths to refer from $HOME as ~ rather than
an absolute path.

Updates #13129

* Changed to absolute paths for docker volume binding.

Volume binding does not work with relative paths.

* Trying with absolute paths for docker working dir
2019-12-03 23:34:40 +05:30
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
Ibrahim Serdar Acikgoz
4859208744 [MM-19969] - When bulk import finds an already existing post, it should delete existing files (#13037) 2019-12-03 10:52:29 +01: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
cpanato
3543fcce6c fix docker image build for master 2019-12-02 19:46:19 +01:00
Ali Farooq
4e5004ddd2 MM-20642 - Failed to install marketplace plugin on older mattermost servers (#13237)
Automatic Merge
2019-12-02 13:42:54 -05:00
Abhisek Datta
b45e11b28c [MM-19880] Limit size of file inside Zip archive before JSON parsing for Slack Import (#12514)
* Limit size of files inside Zip archive before JSON parsing for Slack import

* Use specific log message when skipping file in Slack import zip due to size

* Updated max size for slack import
2019-12-02 18:55:34 +01:00
Carlos Tadeu Panato Junior
6bb2cae219 Update keys (#13281)
* update context and s3 buckets

* update jenkins
2019-12-02 17:46:57 +01:00
Harrison Healey
a0130b86d7 MM-20649 Fix incorrect mention count when marking a DM channel as unread (#13245)
* MM-20649 Fix incorrect mention count when marking a DM channel as unread

* Satisfy govet

* Update missed test
2019-12-02 09:30:08 -05:00
Eli Yukelzon
4e5369e759 MM-19957 - Deactivating a user should increment the Daily and… (#13232)
* corrected active count function
2019-12-02 15:48:36 +02:00
Sanele T. Mahlalela
81cff677b1 fixed localcache emoji layer test description (#13206) 2019-12-02 11:06:11 +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
İlker Göktuğ Öztürk
0adbfa8478 plugin: fix InstallPlugin() API by manually creating RPC code (#13041)
Flugin: fix InstallPlugin() API by manually creating RPC code

previous implementation of InstallPlugin()-#12232 's RPC funcs wasn't working because `io.Reader` isn't supported by the RPC code generation tool.

RPC does not support streaming data and RPC code generation tool does not handle this exception.

thus, RPC funcs are now implemented manually to stream `io.Reader` through a separate multiplexed connection.
2019-11-29 12:41:17 +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
Luke Kingland
e2a2a1a5bc post_test: use testify (#12948)
Automatic Merge
2019-11-28 17:41:51 -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