Commit Graph

10774 Commits

Author SHA1 Message Date
Christopher Speller
f17de7929b Setting bot accounts image to specific image. (#10497)
* Setting bot accounts image to specific image.

* A couple more places to change default.
2019-03-26 15:43:24 -07:00
Daniel Schalla
d89d931b1e Toggle DisableLegacyMFA to true by default (#10504) 2019-03-26 23:24:32 +01:00
Julien Reichardt
64562d53c0 Build tooling enhancements (#10429)
* Add LDFLAGS variable

* Replace curl by wget

* Revert "Replace curl by wget"

This reverts commit f40323c3d2.

* Use curl instead of wget

* Merge GO_LINKER_FLAGS into LDFLAGS
2019-03-26 15:19:12 -07:00
Christopher Poile
7f7f511d1c MM-11697: Environment overrides do not overwrite config.json on save (#10413)
* MM-11697: Environment overrides do not overwrite config.json on save
#10388

The config store now keeps a copy of the config as loaded from the store
without environment overrides. Whenever persisting, we now check if the
current setting is different from the loaded setting. If it is, then use
the loaded setting instead.

As described in the comments to `removeEnvOverrides` in `common.go`,
this behavior will have to change if we ever let the user change a
setting that has been environmentally overriden.

This was interesting because the `load` function in `common.go` also
persists, so we have to tee the provided `io.ReadCloser` and construct a
config that doesn't have the environment overrides. And then we have to
find the path to the (maybe) changed variable in the config struct
using reflection.

Possible WIP: I had to expose a `GetWithoutEnvOverrides` function in the
Store interface just for the tests -- this is because the `file_test`
and `database_test`s are in the config_test package instead of the
`config` package.

* added function documentation

* fixed a small problem with tests

* MM-11697: big cleanup based on Jesse's PR comments

* MM-11697: edits per PR feedback

* MM-11697: licence header

* MM-11697: now testing that on disk config is not changed by env
overrides

* MM-11697: remove unneeded exports
2019-03-26 13:28:41 -07:00
Carlos Tadeu Panato Junior
7b35242ad9 prepare db upgrade to 5.11 (#10510) 2019-03-26 21:06:40 +01:00
Miguel Alatzar
dd3c7b2f0e [MM-13744] Enable NPS plugin if prepackaged (#10485)
* Enable NPS plugin if prepackaged

* Enable NPS plugin in config.go
2019-03-26 12:04:12 -07:00
Jesús Espino
c370d30041 MM-14748: Allow to invalidate email invites (#10509) 2019-03-26 19:30:49 +01:00
Carlos Tadeu Panato Junior
3c8975780d upgrade database to 5.10.0 (#10507) 2019-03-26 13:08:25 -04:00
Christopher Speller
50ef597a69 Fixing GetLDAPUserAttributes to work with SAML as well. (#10498) 2019-03-26 08:36:35 -04:00
George Goldberg
c3c8b28eb7 MM-14626: Make license expiry checks behave how they are meant to. (#10495) 2019-03-26 10:32:59 +00:00
Hanzei
eaeede66b2 Update pull request template (#10142)
* Update pull request template

* Changes as requested

* Link to https://developers.mattermost.com/contribute/server/developer-workflow/#running-only-specific-server-unit-tests

* Move PR and issue template to .github

* Update per feedback

See https://community.mattermost.com/core/pl/1ikmqhzw1ffsfepzyb4575bkih

* Changes as requested

* Remove checklist
2019-03-22 08:31:02 -04:00
Jesse Hallam
8c8b1bbc9c MM-14441: restrict system admin config (#10477)
* tweak utils.Merge docs

* move merge_test to utils_test package for easier testing

* utils: support MergeConfig and StructFieldFilter

* constrain updating certain fields by the restricted system admin
2019-03-21 15:46:38 -04:00
Martin Kraft
3d92af2737 MM-14652: Updates upgrade column type to match gorp. (#10480) 2019-03-20 13:28:48 -04:00
Elias Nahum
693b1c8b4a translations PR 20190318 (#10468) 2019-03-20 08:40:32 -03:00
Christopher Speller
e67f6b07ad Fixing incorrect json conversion for OwnerId (#10475) 2019-03-19 12:59:57 -07:00
Sandeep Sukhani
a9c327c068 [MM-13341] Add an upgrade test to verify schema (#10419)
* [MM-13341] Add an upgrade test to verify schema

Upgrade test is done by following steps:
1. A mysql dump generated from v4.10.0 is imported in a database and is ran through migration code
2. Another fresh database is generated without any initial data, which gets latest schema.
3. Diff between these 2 databases is generated using mysqldiff tool from mysql utilities

For db setup, version cli command is used which takes care of migration or setup of fresh db

* Using 5.7 tag for mysql docker image which is already used for db setup

* Starting docker containers for db before running tests

* Using db from v5.0.0 for migration test

* Added migration test for psql and made some improvements in running commands in docker

* Add postgres db dump file

* Updated message

* moved dump files to scripts and using error code from diff command
2019-03-19 15:05:15 -04:00
Christopher Poile
498b988a6b MM-14442: Merge function, to enable merging of configs (#10423)
* MM-14442: Merge function, to enable merging of configs

Merge will return a new struct of the same type as base and
patch, with patch merged into base. Specifically, patch's values will be preferred
except when patch's value is `nil`.

Restrictions/guarantees:
- base or patch will not be modified
- base and patch can be pointers or values
- base and patch must be the same type
- base and patch must have no unexported types (at the moment)
- if maps or slices are different, the entire map or slice will be
  replaced (at the moment)

* License header

* major rewrite addressing PR comments from Jesse

* MM-14442: merge function for config files

- simplified merge for slices and maps
- fixed many problems with nested pointers/maps/slices
- all references are cloned
- 54 new tests, simplified tests for specific problems

* MM-14442: fixing formatting, comments
2019-03-19 09:45:20 -04:00
Miguel de la Cruz
372ef87f76 [MM-14253] Adds channels and users to the bulk index process (#10434)
* [MM-14253] Adds channels and users to the bulk index process

* Add support for PostgreSQL and sort the user query result

* Add tests for user and channel batch queries

* Fix test times
2019-03-19 12:42:08 +00:00
Jesús Espino
5a9d95d9c7 Adding list/join public/private teams permissions (#10309)
* Adding list/join public/private teams permissions

* Add permission migration and allow to migrate based on role name

* Adding JoinTeam new endpoint

* Addressing PR review comments

* Keep the previous API consistent
2019-03-19 11:36:29 +01:00
Hanzei
030ba52b08 [MM-14576] Add GetBundlePath method to Plugin API (#10466)
* Fix typo

* Add GetBundlePath method to Plugin API

* Change signature to GetBundlePath() (string, error)

* Add test
2019-03-18 18:01:26 -04:00
Martin Kraft
16a9489bbb MM-14416: Adds new fields to Channels and Teams for use by LDAP groups removals. (#10450)
* MM-14416: Updates tests.

* MM-14416: Adds new fields to models and patches.

* MM-14416: Adds upgrade operations.

* MM-14416: Removes the 'is' from the new field names.

* MM-14416: Some fmting and removes API test change for now.

* MM-14416: Adds team patch test.

* MM-14416: Using sql.NullBool.

* MM-14416: Using sql.NullBool.
2019-03-18 15:50:32 +01:00
Miguel de la Cruz
683f215bd9 [MM-14254] Add elasticsearch initialisation to the cmd (#10405) 2019-03-18 15:45:45 +01:00
Elias Nahum
4cc75fc062 MM-14532 Send "clear" notification to every other session (#10459) 2019-03-18 15:34:34 +01:00
Harrison Healey
078e678a34 MM-14620 Specify parameter name for PluginAPI.GetUsers (#10456)
This is to fix the generated code so that it actually passes arguments correctly. If you look at the diff, the client-side call doesn't actually pass any values for the unnamed parameter.

I also filed https://mattermost.atlassian.net/browse/MM-14621 in case we want to actually fix the generator code.

#### Ticket Link
https://mattermost.atlassian.net/browse/MM-14620
2019-03-15 19:55:46 +01:00
Miguel de la Cruz
44887a0272 Adds elasticsearch to the user and channel autocompletion functions (#10354)
* Adds elasticsearch to the user and channel autocompletion functions

* Implement channel store GetChannelsByIds test

* Style changes and govet fixes

* Add gofmt fixes

* Extract default channel search limit to a const

* Add StringSliceDiff function to the utils package

* Honor USER_SEARCH_MAX_LIMIT on the user autocomplete api handler

* Change the elasticsearch development image
2019-03-15 17:53:53 +00:00
Christopher Speller
5dae08761c Improving default session timeout behavour. (#10453)
* Improving default session timeout behavour.

* Changing mind to 180 days instead of 548 days
2019-03-15 10:44:27 -07:00
Fernando Correa Neto
9abd4dd7dc [MM 12464] Include DM/GM Channels and Their Posts in the Bulk Export (#10421)
* transplant the existing PR into the working tree

* start addressing review comments

* move existing direct channel export code into this branch

* modify channel exporter to use squirell and populate members in two steps

* use squirrel to build sql queries for channel and dm/gm export methods

* remove debug helpers and use Username instead of UserId

* unit test for DM Channel exporter

* add more unit tests for channel export

* add test for DM/GM post export

* checkpoint with failing test for postgres

* use getQueryBuilder to make sure squirrel uses the correct formatting
for each database

* add a test for post export

* fix shadowed vars that broke the build

* address review comments and add tests to support it

* address review comments and add a mlog call

* s/Info/Debug/

* address review comments in post_store

* address review comments in channel_store

* address review comments in export

* address review comment in post_store: drop GroupBy

* address review comment on supplier: move getQueryBuilder to sqlstore

* address review comments: explicit TearDown

* address review comments: improve test coverage

* address review comments: make sure public and private channels are excluded

* address review comments: improve test coverage

* address review comments: make sure Channels table gets truncated after
each test

* more cleanups and better assertions

* wrap PostStore in a StoreTestWithSqlSupplier

* last minute changes: improve post export test coverage and check members

* address review comments: make sure all posts have their channel
members set

* address review comments: make sure all posts have their ChannelMembers
exported correctly

* gofmt fix

* sort channels so it's possible to assert on index
2019-03-15 16:28:43 +01:00
Daniel Schalla
eb49713c96 Fix MFA prompt not being shown for hardened mode (#10455) 2019-03-15 16:09:17 +01:00
Jesús Espino
921504483b Removing unnused InviteSalt config (#10446) 2019-03-15 07:06:28 +01:00
Martin Kraft
5dbf8aec7d MM-12488: Accepts parameters to search and filter LDAP groups. (#10418) 2019-03-14 15:43:52 -04:00
Jesse Hallam
e94faea383 Address config startup issues (#10439)
* support --config for the jobserver

* leverage viper to map MM_CONFIG to --config
2019-03-14 16:14:18 +01:00
Harrison Healey
c3365707a4 MM-14335 Add telemetry for NPS plugin state (#10427) 2019-03-14 10:44:24 -04:00
Daniel Schalla
18ca350bd0 Activate Legacy MFA in 5.9 release by default (#10451) 2019-03-14 15:21:52 +01:00
Harrison Healey
f9a6e8dfd9 MM-14558 Downgrade warnings printed by post metadata to be debug messages (#10445)
* MM-14558 Downgrade warnings printed by post metadata to be debug messages

* Revert log level for some post metadata messages
2019-03-14 10:21:43 +01:00
Brad Coughlin
3efd28c2ab [MM-14502] Add experimental flag to enable click-to-reply (#10415) 2019-03-13 17:45:48 -07:00
Harrison Healey
3bbec7e954 MM-14560 Changed local image proxy to be off by default (#10444) 2019-03-13 15:57:18 -04:00
Harrison Healey
dc94e660d1 MM-13740 Add additional plugin APIs for NPS plugin (#10431) 2019-03-13 09:31:47 -07:00
Miguel de la Cruz
434d01a284 [MM-14361] Initialise the translations before loading the config store (#10435) 2019-03-12 17:50:48 +00:00
Martin Kraft
ca52ca7016 MM-14415: Removes 'CanLeave' field. (#10426) 2019-03-12 08:58:18 -04:00
Jesús Espino
62a94d53f4 MM-14488: Autogenerate mention_keys on creation if mention_keys aren't provided (#10430)
* MM-14488: Autogenerate mention_keys on creation if mention_keys aren't provided

* Fixing test case
2019-03-12 09:29:55 +01:00
Sandeep Sukhani
fdf9c3e218 [MM-10199] Capture of stack traces into Mattermost logs (#10379)
* [MM-10199] Printing stack traces from http handlers panics in mattermost logs

Previously recovery handlers from gorilla mux was used, which was printing stack traces from panics in stderr
Removing it should print stack traces into logger passed to http.Server, which as of now is created from mlog

Refer #10351

* Logging errors from http server at error level instead of info level
Added test for verifying whether panic gets logged in server logger

* Fixed failing test due to tls error

* Closing temp file for panic log before removing and checking errors for closure and removal

* Added regular log line in panic handler for TestPanicLog to check whether it gets logged
2019-03-11 13:02:34 -04:00
Carlos Tadeu Panato Junior
27daa7b45b remove stale bot in favor of mattermod (#10428) 2019-03-11 16:39:22 +01:00
Yusuke Nemoto
1684f240e0 [MM-4819] Add MinimumHashtagLength config (#10248)
#### Summary
Add `MinimumHashtagLength` config

#### Ticket Link
#9156 
https://mattermost.atlassian.net/browse/MM-4819

#### Checklist
N/A
2019-03-11 14:09:50 +01:00
Jesús Espino
86a3bd064b MM-14481: Do not allow to edit or delete in archived channels (#10422)
* MM-14481: Do not allow to edit or delete in archived channels

* Fixing govet

* Adding new tests
2019-03-11 09:26:31 +01:00
Jesse Hallam
9ef8c1e8b1 MM-14439: experimental restrict system admin (#10414)
* api4: break out license and config from system

* app: move some config functions from admin.go to config.go

* add ExperimentalSettings.RestrictSystemAdmin

* forbid various actions to restricted system admin

* update default.json

* fix function names in errors
2019-03-08 13:15:28 -05:00
Jesús Espino
200cfdd4a7 Fixing emojis and webhooks permissions split (#10420) 2019-03-08 11:40:44 +01:00
Yusuke Nemoto
74c2759117 Trigger mentions for keyword including multibyte characters in sentences (#10262) 2019-03-08 15:44:25 +08:00
Carlos Tadeu Panato Junior
c7802d2433 remove reference from jenkins (#10417) 2019-03-07 17:26:11 +01:00
Jesús Espino
84afd47021 Split Emojis and Webhooks permissions (#10239)
* Split Emojis and Webhooks permissions

* Fixing some tests

* Fixing more tests

* Fix more tests

* Fixed review comments

* Fixing review comments
2019-03-07 16:07:09 +01:00
Jesse Hallam
a4e3dfaebc TestDoCommandRequest: fix non-determinism (#10391)
This test would sometimes fail spuriously because the timeout wasn't triggered. Instead, just make the "slow" HTTP server block altogether.
2019-03-07 09:00:00 -05:00