Commit Graph

480 Commits

Author SHA1 Message Date
Jesús Espino
633d82f0ac Remove Custom statuses feature flag (#17075) 2021-03-05 10:21:58 +02:00
Jesús Espino
9cc5089af8 Moving mlog to corelibs (#16915)
* Moving mlog to corelibs

* Regenerating app layers

* Fix golangci-lint problem

* Fixing golangci-lint errors

* Renaming from corelibs to shared

* Renaming from corelibs to shared

* Fixing import

* Fixing merge problems

* Fixing build
2021-03-05 09:18:37 +01:00
Joram Wilander
d9484d6ba9 Add cloud attributes to feature flags and allow non-cloud servers to use split.io sync (#17028)
* Add cloud installation and group id to feature flag attributes

* Add some debug lines

* Allow non-cloud servers to use split.io for feature flag management
2021-03-04 16:56:26 -05:00
Ibrahim Serdar Acikgoz
c63c9716cd config/migrate_test: add cleanup (#17045) 2021-03-04 17:01:31 +03:00
Jesús Espino
5dd2e75c10 Extracting i18n functionality to i18n core library (#16914)
* extracting i18n functionality to i18n core library

* Removing utils.T

* Adding documentation and changing one function name for better explanation

* Changing other missing utils.T

* Adding license string

* Renaming corelibs to pkg

* Renaming corelibs to pkg (moving directory)

* Renaming from pkg to shared

* Fixing bodyPage.Html casing

* Fixing merges

* Fixing merge problem

* Fixing tests
2021-02-26 08:12:49 +01:00
Haardik Dharma
6356e906e0 [Partial Fix - #16623]: Fix initialism errors in codebase. (#16877)
* Update files in /app

* Update files in /plugin

* Update files in /store

* Update files in /utils

* Update files in /web

* Update store.go

* Update command_response.go

* check-mocks and check-store-layer checks

* Fix build errors

* Revert "Fix build errors"

This reverts commit 4ee38c3d0b.

* Update .golangci.yml

* make i18n-extract and make i18n-check

* Commit suggestions

* check-mocks and check-store-layers

* Update en.json

* Update product_notices.go

* Update main.go

* Fix translations

* Regenerate mocks

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Claudio Costa <cstcld91@gmail.com>
2021-02-18 15:36:56 +01:00
Chetanya Kandhari
7585e16d84 Custom status feature (#16835)
* Create the system console setting and send to webapp

* MI-1145: Add custom status APIs

* MI-1145 Add slash commands to set and clear status

* Add validation for custom status API

* Trim custom status message

* Code refactoring

- Run gofmt

- Rename constants

* Remove sendUserUpdated webhook event

* Fix recent custom status length

* Update error conditions

* Disable /status slash command when config setting is off

* MI-1155: Create the feature flag for custom status APIs and slash commands

* Move recent custom statuses to user preferences (#7)

* Move recent custom statuses to user preferences

* Code refactoring and feedback changes

* Update slash command text and emoji regex

* Make the custom status feature flag off by default

* Update SetCustomStatus, handle recents not set better

* Update status codes

* Update slash command handling

* Add telementry settings

* Fix i18n order

* Revert "Fix i18n order"

This reverts commit 499f7eaca8.

* Update i18n strings
2021-02-18 12:08:01 +01:00
Mahmudul Haque
2b038db6ad unparam lint (#16901)
Automatic Merge
2021-02-12 10:22:27 +01:00
Mehmet Akif
219bcf218b Duplucate test scenario fix (#16829)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-02-11 21:21:21 +01:00
Mahmudul Haque
7dd4d4859b unparam lint (#16865)
Automatic Merge
2021-02-09 18:52:27 +01:00
Claudio Costa
3beb09d62c Fix flaky test (#16874) 2021-02-05 16:31:53 +01:00
Claudio Costa
e77a3923c9 [MM-32389] Fix FeatureFlags section erroneously getting written to config (#16836)
* Fix FeatureFlags section erroneously getting written to config

* Avoid invoking config listeners if config has not changed

* Avoid resetting feature flags on store creation
2021-02-03 21:03:09 +01:00
Hossein
01f264cd62 [MM-31790] Support Packet Generation BACKEND (#16667)
* init commit

* clean up the code

* make mocks

* fix translations

* mocks and lint fixes

* add tests

* little fixes

* Update i18n/en.json

Co-authored-by: Scott Bishel <scott.bishel@mattermost.com>

* Update i18n/en.json

Co-authored-by: Scott Bishel <scott.bishel@mattermost.com>

* Update i18n/en.json

Co-authored-by: Scott Bishel <scott.bishel@mattermost.com>

* Update i18n/en.json

Co-authored-by: Scott Bishel <scott.bishel@mattermost.com>

* Update i18n/en.json

Co-authored-by: Scott Bishel <scott.bishel@mattermost.com>

* Address Comments

* fix i18n

* update api endpoint

* add enable file and file level for conditional show of banner

* Address Comments

* Make it more clear about returns

* Create zip file utility function

* update en.json

* address comments

* write tests

* check for data in test

* remove warning string

* Correct expected and actual

* set database through environment variables

* reset environment variable at end of test

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Scott Bishel <scott.bishel@mattermost.com>
2021-02-01 15:18:52 -05:00
Claudio Costa
9c9fbe6dd9 [MM-32234] Fix config.json getting reset (#16805)
* Add support for read-only config stores

* Allow read/write config store for plugin commands that require it
2021-01-28 20:04:17 +01:00
Madhav Hugar
94c24eea20 Fix empty string comparison issues in the codebase (#16686)
Automatic Merge
2021-01-25 11:15:17 +01:00
Devin Binnie
95ee824c8b [MM-30851] Replace ExperimentalChannelSidebarOrganization with EnableLegacySidebar (#16529)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-01-18 10:15:31 -05:00
Eli Yukelzon
b0bddeb5e6 MM-29988 - Update exising Post APIs with collapsed threads (#16503) 2021-01-14 13:46:27 +02:00
Agniva De Sarker
bcacc78f77 MM-31369: Fix racy test FileStoreWatcherEmitter encore (#16657)
There was a mistake in my earlier analysis. t.Parallel only
applies to the current test and not its subtests.

There is some other test running with t.Parallel that is causing duplicate
file watcher events to be fired. I have now verified that removing this
causes the race to go away in CI
2021-01-11 15:21:21 +05:30
Agniva De Sarker
e89b26e8f3 goimports (#16640)
* format using `goimports -local github.com/mattermost/mattermost-server/v5 -w`

* added goimports lint check to .golangci.yml

* format using `goimports -local github.com/mattermost/mattermost-server/v5 -w` for a corner case

* make app-layers, *-mocks and store-layers for ci check

Co-authored-by: Mahmudul Haque <mahmudulhaque@protonmail.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-01-07 22:42:43 +05:30
Agniva De Sarker
fa2e13dcd3 MM-31369: Fix racy test TestFileStoreWatcher (#16561)
Since this test had t.Parallel set, it would run the sub-tests
in parallel. The issue was that the same file path was being written
from the 2 sub-tests causing duplicate firing of the event handlers.

This would cause a race where the store would be closing, and at the same time,
an event handler would fire, trying to read the fs.watcher field.

Having two separate file paths resolves this.

https://mattermost.atlassian.net/browse/MM-31369

```release-note
NONE
```
2021-01-04 08:33:40 -08:00
Miguel de la Cruz
e057e5b10b [MM-31085] Create a db init command to initialize the database (#16489)
Automatic Merge
2020-12-16 20:45:17 +01:00
John Tzikas
1fe003aa36 Add shared channels related configuration under a E20 license check (#16415)
* Add shared channels related configuration under a E20 license check

* Apply PR suggestions; Default config value for shared channels

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-12-10 11:25:38 +02:00
Scott Bishel
f548ecbee1 MM-27688-OpenId Connect (#16222)
* implement openid connect

* update error strings

* handle OpenIdSetting.Secret as FAKE SETTING

* add openid to telemetry

* update config defaults, add telemetry

* fix bug with Office365

* Retrieve Office365 AuthData from IdToken

* fix linter

* add feature flag, reset defaults for config

* fix build error

* fix unit tests

* add authentication permission to Feature
Flags

* turn off feature flag

* set default button color

* set default button color only on openid

* fix for merging FeatureFlags in config

* remove feature flag

* revert config changes

* remove debug statements

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-12-08 19:58:37 -07:00
Gabe Jackson
ab7c92a28b Limit configuration database connections (#16512)
When configuration is backed by a database, a separate pool of
connections is used for access from the primary database. This
change sets sensible config DB connection limits in order to
reduce database resource usage at scale.
2020-12-08 11:44:30 -05:00
Gabe Jackson
fe7d9f7643 Additional Config Store Cleanup (#16440)
This change addresses a few issues where config stores were not
properly closed when an error was encountered on server startup.
This could result in leaked database connections when dealing with
a database config store.
2020-12-03 10:09:31 -05:00
Sudheer
6cebcead22 MM-27989 Remove experimental setting for data prefetch (#16306)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-12-02 11:14:30 -05:00
Jesús Espino
a74fe05695 Removing supplier concept from the sql store (#16355)
* Removing supplier concept from the sql store

* Removing other metions to supplier

* Fixing gofmt

* Fixing gofmt

* Renaming NewSqlStore to New

* Fixing tests

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-12-02 12:06:23 +01:00
John Tzikas
3fdc6cb531 Fix misspellings and enable misspell on ci (#16285)
Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
2020-12-01 16:27:05 +01:00
Christopher Speller
a87e8d1c20 MM-30740 Add support for boolean feature flags. (#16311)
* Add support for boolean feature flags.

* Tests

* Use strconv.ParseBool to accept additional values as true.

* Update config/feature_flags.go

Co-authored-by: Christopher Poile <cpoile@gmail.com>

Co-authored-by: Christopher Poile <cpoile@gmail.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-11-25 07:27:06 -08:00
Christopher Speller
ceb1422a5c MM-29709 Client side feature flags (#16212)
* Client side feature flags.

* Fix test.

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-11-18 11:11:15 -08:00
Miguel de la Cruz
6c857a4525 [MM-30436] Add support for configuration custom defaults (#16265)
* [MM-30436] Add support for configuration custom defaults

* Addressing review comments

* Addressing PR comments

* Soft fail if the configuration defaults cannot be read

* Directly print error in log message

* Fix linter

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-11-16 15:25:48 +01:00
Harrison Healey
059672ba73 MM-30090 Add ManagedResourcePaths setting (#16213) 2020-11-05 11:07:03 -05:00
Christopher Speller
1aadd36644 MM-28859 Add feature flag managment system using split.io and remove viper. (#15954)
* Add feature flag managment system using split.io and remove viper.

* Fixing tests.

* Attempt to fix postgres tests.

* Fix watch filepath for advanced logging.

* Review fixes.

* Some error wrapping.

* Remove unessisary store interface.

* Desanitize SplitKey

* Simplify.

* Review feedback.

* Rename split mlog adatper to split logger.

* fsInner

* Style.

* Restore oldcfg test.

* Downgrading non-actionable feature flag errors to warnings.

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-10-29 15:54:39 -07:00
Maria A Nunez
7381b4c0e5 MM-27454 - Added CWSUrl to Client Config (#15916) 2020-10-12 22:46:22 -04:00
Ibrahim Serdar Acikgoz
40371d8616 config/envrionment: fix a panic where a setting is not defined in (#15819)
model.Config
2020-10-07 09:33:53 +03:00
Agniva De Sarker
0e90606547 MM-29011: Add feature flag for shared channels (#15585)
* MM-29011: Add feature flag for shared channels

https://mattermost.atlassian.net/browse/MM-29011

* gofmt

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-10-01 10:37:15 +05:30
Christopher Speller
e974b7b9be MM28858 Basic framework for use of feature flags. Enviroment variable overrides. (#15544)
* Basic framework for use of feature flags. Enviroment variable overrides.

* Use Apperr instead of error number increments.

* Undo random viper change.

* Update model/config_test.go

Co-authored-by: Jesse Hallam <jesse.hallam@gmail.com>

Co-authored-by: Jesse Hallam <jesse.hallam@gmail.com>
2020-09-29 21:41:22 -07:00
Eli Yukelzon
4e9ddd4686 MM-27918 In-Product notices support (#15316) 2020-09-21 10:28:46 +03:00
Claudio Costa
334cf9d84a [MM-28131] Fix desanitization of DataSourceReplicas and DataSourceSearchReplicas (#15389)
* Fix desanitization of DataSourceReplicas and DataSourceSearchReplicas

* Fix test case

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-09-17 20:16:59 +02:00
Doug Lauder
1b67322fb9 MM-27744 disable Zap for unit tests. (#15398)
MM-27744 disable Zap for unit tests.

Zap has no concept of shutdown or close. Zap is only shutdown when the app exits. Not a problem for console logging, but when creating a new Zap logger that outputs to files on every unit test, that leaves no easy way to clean up until process exit. Depending on what else is running this can exhaust all file handles and cause unit tests to fail.

Zap is now disabled unit tests and uses Logr instead, regardless of config settings. `make test-server` peak file handle usage dropped from ~5K to less than 100.
2020-09-09 15:25:55 -04:00
Jesús Espino
44079785eb Moving diagnostics into a service (#14832)
* Moving diagnostics into a service

* Fixing golint checks

* Fixing tests

* Renaming from diagnostics to telemetry

* Adding missing files

* Initializing telemetry earlier in the server startup

* Fixing tests

* Adding a log for the telemetryID initialization error

* Addressing PR review comments

* Fixing merge problem

* Removing some extra Diagnostics mentions

* Making tests pass
2020-09-08 20:30:54 +02:00
Devin Binnie
c1ac3e69f0 [MM-28313] Add Cloud Billing feature flag (#15391) 2020-09-03 10:10:59 -04:00
Martin Kraft
c6b20ab133 MM-27525: Sanitizes gifycat's and Oauth secrets. (#15348) 2020-08-31 11:48:39 +05:30
Nick Misasi
4f0a33eea7 Change ExperimentalCloudUserLimit config to be base 10 (#15342) 2020-08-25 14:10:05 -04:00
Agniva De Sarker
94d09e1336 Fix return nil (#15330)
* Fix return nil

A nil error is an interface having nil value but a non-nil type.
This leads to unexpected errors in the code well-documented here:
https://golang.org/doc/faq#nil_error

We fix this by passing an additional parameter to handle it.

Caught using https://github.com/dgryski/semgrep-go

* Bring back auto-generated line
2020-08-24 11:16:35 +05:30
Martin Kraft
7cc26bf659 MM-27525: Obscure Global Relay's SMTP password. (#15228)
* MM-27525: Obscures the Global Relay SMTP password.

* MM-27525: Desanitize global relay's SMTP password.

* MM-27525: Does not set the fake value if the field is blank.
2020-08-20 09:01:22 -04:00
nickmisasi
769f39eee5 [MM-27535] User invite limits for MM Cloud (#15197)
* Add a config for MM User Limit

* Adding graceful errors for if an administrator invites people passed their user limit

* Including changed vendor files

* Adding unit test

* Fix a bug

* Push up working tests (Thanks Joram)

* Add more cases, clean up logs in code

* One more case

* Refactoring based on PR comments

* Updating i18n

* Some changes based on PR review

* Remove a comment

* Bring back some translations that were somehow removed

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-08-19 16:01:07 -04:00
Alejandro García Montoro
70e649b36a MM-27178: Use FileSettings.Directory in export tool (#15100)
* MM-27178: use FileSettings.Directory in export

* Set empty FileSettings.Directory to default value

* Validate that FileSettings.Directory is non-empty

* Don't set FileSettings.Directory to / in fixConfig

* Run make i18n-extract

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-08-04 13:58:48 +02:00
Doug Lauder
90ff87a77f MM-25731 Advanced Logging (#14888)
Adds Advanced Logging to server. Advanced Logging is an optional logging capability that allows customers to send log records to any number of destinations.

Supported destinations:
- file
- syslog (with out without TLS)
- raw TCP socket (with out without TLS)

Allows developers to specify discrete log levels as well as the standard trace, debug, info, ... panic. Existing code and logging API usage is unchanged.

Log records are emitted asynchronously to reduce latency to the caller. Supports hot-reloading of logger config, including adding removing targets.

Advanced Logging is configured within config.json via "LogSettings.AdvancedLoggingConfig" which can contain a filespec to another config file, a database DSN, or JSON.
2020-07-15 14:40:36 -04:00
Sudheer
50fd95717e MM-26620 Add a config setting for controlling ask community link (#14985)
* MM-26620 Add a config setting for controlling ask community link

* Update setting

* Change to support setting
2020-07-09 17:59:22 +05:30