Commit Graph

180 Commits

Author SHA1 Message Date
Mario de Frutos Dieguez
c0971970e9 Revert "Fix initialism errors (PR-3) (#17062)" (#17202)
This reverts commit ea61458f16. This was causing panic in the plugins because the client and the plugin API changed with this PR
2021-03-23 10:32:54 +01:00
Haardik Dharma
ea61458f16 Fix initialism errors (PR-3) (#17062)
* Fix initialism errors

* Revert some changes and regenerate file

* Update client4.go

* Update group_test.go

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-03-22 22:38:19 +03:00
Mahmudul Haque
62fa7b9350 unparam lint (#16927)
* fix "always receives ..." lint err

* add unparam lint check

* fix failed test

* rm details param

* ignore unparam lint

* magic string replaced with model.NewRandomString

* rm unused enableComplianceFeatures param

* generate random message inside createPost

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-03-16 12:48:20 +05:30
Jesús Espino
8abb4184b5 Extracting mail service into shared libs (#17030)
* Extracting mail service into shared libs

* Fixing golangci-lint
2021-03-15 11:50:13 +01:00
Martin Raymond Kraft
58dce5930e [MM-31094] Replication Lag (#16888)
* MM-31094: Adds tooling to develop and test using a MySQL instance with replication lag. Adds some lazy lookups to fallback to master if results are not found.

* MM-31094: Removes mysql-read-replica from default docker services.

* MM-31094: Switches (store..SessionStore).Get and (store.TeamStore).GetMember to using context.Context.

* MM-31094: Updates (store.UsersStore).Get to use context.

* MM-31094: Updates (store.PostStore).Get to use context.

* MM-31094: Removes feature flag and config setting.

* MM-31094: Rolls back some master reads.

* MM-31094: Rolls a non-cache read.

* MM-31094: Removes feature flag from the store.

* MM-31094: Removes unused constant and struct field.

* MM-31094: Removes some old feature flag references.

* MM-31094: Fixes some tests.

* MM-31094: App layers fix.

* MM-31094: Fixes mocks.

* MM-31094: Don't reparse flag.

* MM-31094: No reparse.

* MM-31094: Removed unused FeatureFlags field.

* MM-31094: Removes unnecessary feature flags variable declarations.

* MM-31094: Fixes copy-paste error.

* MM-31094: Fixes logical error.

* MM-30194: Removes test method from store.

* Revert "MM-30194: Removes test method from store."

This reverts commit d5a6e8529b.

* MM-31094: Conforming to make's strange syntax.

* MM-31094: Configures helper for read replica with option.

* MM-31094: Adds some missing ctx's.

* MM-31094: WIP

* MM-31094: Updates test names.

* MM-31094: WIP

* MM-31094: Removes unnecessary master reads.

* MM-31094: ID case changes out of scope.

* MM-31094: Removes unused context.

* MM-31094: Switches to a helper. Removes some var naming changes. Fixes a merge error.

* MM-31094: Removes SQLITE db driver ref.

* MM-31094: Layer generate fix.

* MM-31094: Removes unnecessary changes.

* MM-31094: Moves test method.

* MM-31094: Re-add previous fix.

* MM-31094: Removes make command for dev.

* MM-31094: Fix for login.

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-03-12 12:37:30 -05:00
Berke Kalkan
f5590d4e5f MM-29726 Allow disabling link previews from certain domains (#16869)
* Add field to config model

Config option for disabling link previews for given domains.

* Refactor functions and corresponding tests

* Expand logic for link preview

Newly added isLinkAllowedForPreview function determines whether a link
should display a preview. It gets corresponding config values consisting
of comma separated domain values, normalizes them and checks for
matches.

* Create tests for link preview restriction

* Fix formatting issue

* Add test cases where images are expected

* Apply suggestions from code review

Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>

* Apply remaining code suggestions

* Add RestrictLinkPreviews value to telemetries

Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Harrison Healey <harrisonmhealey@gmail.com>
2021-03-09 12:54:54 -05: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
Jesús Espino
78355ae2a7 Moving filesstore services into shared folder (#16940)
* Moving filesstore services into shared folder

* Fixing app-layers generation

* Renaming from filesstore to filestore
2021-03-02 14:37:21 +01:00
Jesús Espino
5f9ab3783a Moving MFA service into shared libs (#16969)
* Moving MFA service into shared libs

* Fixing i18n extraction issue

* Fixing tests
2021-03-02 10:14:46 +01: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
Jesús Espino
85293fcf41 Add the API for search files (#15605)
* Adding search files api

* Fixing golangci-lint

* Adding bulk-indexing and improving a bit the name indexing for bleve and elasticsearch

* Add content extraction config migration

* Fixing a problem with document extraction

* Unapplying certain changes moved to other PR

* Fixing tests

* Making extract content app migration a private method

* Addressing PR review comments

* Addressing PR review comments

* Adding feature flag

* Removing debug string

* Fixing imports

* Fixing linting errors

* Do not migrate the config if the feature flag is not enabled

* Fix tests

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-02-26 07:41:05 +01:00
Jyoti Patel
87f553283a [GH-15906][MM-22844] Redesign welcome and verify email. (#16824)
Automatic Merge
2021-02-26 05:22:26 +01:00
Ibrahim Serdar Acikgoz
0ba28a712a [MM-32348] services/bleve: only log update conf when there is an actual change (#17003)
* services/bleve: only log update conf when there is an actual change

* Update services/searchengine/bleveengine/bleve.go

Co-authored-by: Miguel de la Cruz <miguel@mcrx.me>

Co-authored-by: Miguel de la Cruz <miguel@mcrx.me>
2021-02-25 17:31:26 +03:00
Jesús Espino
8199e7b5f3 Fix mailservice tests race condition (#16999) 2021-02-23 15:55:16 +01:00
Atanas Alexandrov
e44190f4cc NO-TCIKET fix bad smells - error strings should not be capitalized (#16930)
Automatic Merge
2021-02-23 06:22:27 +01:00
Jesús Espino
2b6c0e9746 Adding bulk-indexing and improving a bit the name indexing for bleve and elasticsearch (#16704)
* Adding bulk-indexing and improving a bit the name indexing for bleve and elasticsearch

* Update services/searchengine/bleveengine/bleve.go

Co-authored-by: Mario de Frutos Dieguez <mario@defrutos.org>

* Update store/sqlstore/file_info_store.go

Co-authored-by: Mario de Frutos Dieguez <mario@defrutos.org>

* Update store/sqlstore/file_info_store.go

Co-authored-by: Mario de Frutos Dieguez <mario@defrutos.org>

* Adding tests requested in the PR review

* fixing tests

* Adding a feature flag to avoid indexing files before the feature is released

* Fixing i18n

Co-authored-by: Mario de Frutos Dieguez <mario@defrutos.org>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-02-22 14:28:52 +01:00
Jesús Espino
5f190b5624 Isolate more the mfa service (#16925)
* Isolate more the mfa service

* Simplifing the mfa service

* Removing channels and adding waitgroup

* Migrating mfa service to regular errors

* Fixing tests

* i18n extract

* Addressing PR review comments

* Removing unneeded struct
2021-02-18 12:12:21 +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
Jesús Espino
d06a62ce64 Reduce the coupling of the mailservice with the rest of the application (#16898)
* Reduce the coupling of the mailservice with the rest of the application

* Fixing tests in CI

* Simplifiying mailservice config

* Addressing PR review comments

* Fixing tests

* Removing unnecesary type definition

* Fixing ServerName usage
2021-02-16 12:42:03 +01:00
Ibrahim Serdar Acikgoz
e9ea3abbf5 [MM-32136] add "telemetry: disabled" comments to the Config struct (#16758)
* add config telemetry comments

* reflect review comments

* add ThreadAutoFollow and EnableLinkPreviews to telemetries

* ignore NativeAppSettings.AppCustomURLSchemes from tm

* add export settings to telemetries
2021-02-15 22:26:19 +03:00
Jesús Espino
a3de71fba4 Reducing the filestore dependencies from the rest of the source code (#16816)
* Reducing the filestore dependencies from the rest of the source code

* Making more generic config conversion to FileBackendSettings

* Fixing usage of the NewFileBackend function

* Fixing more usages of the NewFileBackend function

* Fix some linter errors

* Fix more linter errors

* Fixing some unit tests

* Fixing linter problem

* Addressing PR review comments

* Simplifing the CopyFile for tests

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-02-15 10:09:28 +01:00
Jesús Espino
5f043b0a08 Changed require.Nil to require.NoError when error type is used (#16900) 2021-02-10 09:30:36 +01:00
Anurag Shivarathri
0abceccb58 MM-32047:Added AppCustomURLSchemes settings to telemetry (#16796)
* Added AppCustomURLSchemes to telemetry

* Added Slices compare check isDefault function

* Replaced reflect based solution for comparing string slices

* added default array

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-02-09 21:24:28 +05:30
Jesús Espino
fbe0294e86 Migrating AppError to error for mailservice (#16810)
* Migrating AppError to error for mailservice

* Updating i18n strings

* Fixing shadow variable problem

* Addressing PR review comments

* fixing test
2021-02-09 12:28:42 +01:00
Atanas Alexandrov
cda69d4dd7 [NO-TICKET] Remove unused function attributes (#16878) 2021-02-08 14:41:07 +05:30
Mahmudul Haque
a63dea6c55 unparam lint (#16771)
* fixed: `identifier` is unused lint error

* make saveMultipleMembersT method saveMultipleMembers

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-02-04 11:08:05 +05:30
Atanas Alexandrov
a31f666019 [NO-TICKET] Cleanup - remove unused code (#16828) 2021-02-02 11:28:31 +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
Agniva De Sarker
5b45b0762e MM-31993: Add flag to disable gossip compression (#16701)
* MM-31993: Add flag to disable gossip compression

Load tests have shown that our workload is not very suitable
to LZW compression. And in fact, compressing leads to more
network bandwidth than less. So we are spending more CPU cycles,
and creating more traffic, leading to a lose-lose situation.

We add a flag to control this behavior. Ideally, this should not
be a flag in the first place, since there is never a need to enable this
because clearly there is no benefit.

But to keep our community servers working, we need to be able
to configure this.

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

```release-notes
Add a flag to disable compression in the Gossip protocol.

By default the value of the flag is false, which is not the existing
default. Therefore, this will cause incompatibility issues during upgrade
where servers of different versions are part of the same cluster.
It is recommended to completely shutdown a cluster, and then do an upgrade.
```

* flip flag to true

* Trigger CI

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-01-28 11:41:03 +05:30
Agniva De Sarker
2846ad9f93 MM-31391: Add max connection idle timeout to config (#16792)
* Update config.go

* Update telemetry.go

* Update store and store test

* Update settings.go

* use new error code

* Trigger CI

Co-authored-by: Haardik Dharma <dharmahaardik08@gmail.com>
2021-01-28 09:37:15 +05:30
Arjuna Marambe
5f16fc644a 15249 sync.pool (#16103)
* use sync.pool for session

* added back to sync pool

* reverted change

* added a new line

* added back session object

* added back session object

* added back session object

* revert

* refactored into function

* added the session object back into the pool

* work in progress

* work in progress

* work in progress

* code review comments

Co-authored-by: Arjuna Marambe <arjunam@buildxact.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-01-27 19:58:24 +01:00
Madhav Hugar
94c24eea20 Fix empty string comparison issues in the codebase (#16686)
Automatic Merge
2021-01-25 11:15:17 +01:00
Claudio Costa
200a56fa5a [MM-28423] Implement ImportDelete job (#16588)
* Implement ImportDelete job

* Add missing translation

* Improve logging

* Avoid deleting the file in case of errors
2021-01-25 10:40:30 +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
Jesús Espino
2a63b5552a Add search engine support for files (#16190)
* Add search engine support for files

* Fixing i18n

* Fix golangci-lint

* Fix consistency problem in the Search receiver functio of the SqlFileStore

* Fixing some tests

* Fixing test

* Apply suggestions from code review

Co-authored-by: Mario de Frutos Dieguez <mario@defrutos.org>

* Addressing PR review comments

* Removing some empty lines

* Address PR review comments

* Fixing problem after merge master

* Fixing spelling problem

* Add missed translations

* Fixing certain global variable usages after merge master

* Fixing some constants usage

* Fixing goimports order

Co-authored-by: Mario de Frutos Dieguez <mario@defrutos.org>
2021-01-11 15:14:16 +01:00
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
091659c8ad MM-31436: Upgrade dependencies (#16605)
* MM-31436: Upgrade dependencies

Ran make update-dependencies

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

```release-note
NONE
```

* add missing dep

* fix lru marshaling
2021-01-07 14:39:17 +05:30
Agniva De Sarker
09d2f698cc MM-31061: Remove pointers to slice (#16631)
* MM-31061: Remove pointers to slice

This PR removes instances of pointers
to slices in the codebase. There are some other instances in app/import_functions.go
but that's necessary to prevent empty arrays from appearing in the JSON output.

```release-note
NONE
```

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

* fix tests
2021-01-06 21:23:00 +05:30
Ibrahim Serdar Acikgoz
f9c0c1072f [MM-31360] downgrade error logs which doesn't break the flow (#16612)
* downgrade error logs which doesn't break the flow

* reflect revivew comments
2021-01-04 17:02:34 +03:00
Agniva De Sarker
c1dd23a3c8 MM-31063: Change constants to use CamelCase (#16608)
* MM-31063: Change constants to use CamelCase

* store package

* change allcaps to camel case (#16615)

* New tools.mod

Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
2021-01-04 11:32:29 +05:30
Ibrahim Serdar Acikgoz
40e16ba07f [MM-31359] remove duplicated error logs (#16583)
* remove duplicated error logs

* reflect review comments

* add context

* add error details
2020-12-29 09:48:36 +03:00
Agniva De Sarker
c54b262351 MM-31356: Add a minimum required version check for Postgres (#16597)
* MM-31356: Add a minimum required version check for Postgres

To keep conformance with our failing fast and obvious philosophy,
we add a check to prevent Mattermost server from starting
if the postgres version is below 10.0.

This gives customers a chance to upgrade their database before upgrading
their Mattermost version, than to run into weird compatibility issues
after they have finished the upgrade.

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

```release-note
NONE
```

* fix lint errors

* Use a function to pretty-print version string

* rectify comment
2020-12-23 22:06:13 +05:30
Agniva De Sarker
1a131b54af MM-31064: Simplify indentation (#16565)
* MM-31064: Simplify indentation

Reduce indentation where possible.

```release-note
NONE
```

Command ran to verify:
golangci-lint run --disable-all --enable golint --max-issues-per-linter=10000 --max-same-issues=100000 ./... | grep "block ends with a return state"

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

* incorporate review comments

* enable golint for outdent rule

* fix remaining issues

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-12-21 18:50:47 +03:00
Jesús Espino
7419898449 Remove usages of AppError on filesstore service (#15841)
* Remove usages of AppError on filesstore service

* Fixing a golint error

* Fixing shadowed variable

* Adding err.Error() to the NewAppError calls

* Fixing tests

* Adding missed translations

* Fix error handling and updating the translation that affects it

* Fixing two typos
2020-12-20 12:53:07 +01:00
Florent Peterschmitt
349b83f23a implement and use striped LRU cache to lower mutex contention (#15764)
* Implement Striped LRU cache

* ci

* fix

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-12-09 19:25:14 +05:30
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
Jesse Hallam
cd9185fa23 MM-30801: pre-package channel export plugin (#16406)
* MM-30801: pre-package channel export plugin

The [channel export plugin](https://github.com/mattermost/mattermost-plugin-channel-export) complements [incident management](https://github.com/mattermost/mattermost-plugin-incident-management).

* only enable IM/CE by default on enterprise ready builds
2020-12-04 15:09:05 -04:00
Claudio Costa
df906cad9d [MM-28422] Enable processing of import files through API (#16062)
* Implement unzip function

* Implement FileSize method

* Implement path rewriting for bulk import

* Small improvements

* Add ImportSettings to config

* Implement ListImports API endpoint

* Enable uploading import files

* Implement import process job

* Add missing license headers

* Address reviews

* Make path sanitization a bit smarter

* Clean path before calculating Dir

* [MM-30008] Add mmctl support for file imports (#16301)

* Add mmctl support for import files

* Improve test

* Remove unnecessary handlers

* Use th.TestForSystemAdminAndLocal

* Make nouser id a constant
2020-12-03 11:38:00 +01: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