Commit Graph

1244 Commits

Author SHA1 Message Date
Agniva De Sarker
4c5ea07aff MM-33836: Detect and upgrade incorrect HTTP version for websocket handshakes (#17142)
Our proxy configuration was historically incorrect, due to which
a lot of customers have that in their setups. As a result, strictly
following the websocket RFC results in a breaking change.

For now, we transparently upgrade the version header to 1.1, if we detect 1.0.
If a client was sending 1.0, it wouldn't have worked anyways because persistent
connections were introduced from 1.1 onwards.

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

```release-note
WebSocket handshakes done with HTTP version lower than 1.1 will result in a warning,
and the server will transparently upgrade the version to 1.1 to comply with the
websocket RFC.

This is done to work around incorrect nginx (and other proxy) configs that do not set
the proxy_http_version directive to 1.1.

This facility will be removed in a future Mattermost version and it is strongly recommended
to fix the proxy configuration to correctly use the websocket protocol.
```

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-03-15 23:02:24 +05:30
Ibrahim Serdar Acikgoz
78532699d0 api4/user: add promte/demote uset to local router (#17036) 2021-03-15 18:20:58 +01:00
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
Allan Guwatudde
05720f627b [MM-33198] - Portal: Send admin welcome email after the installation is complete (#17043)
* [MM-33198] - Portal: Send admin welcome email after the installation is complete

* Send cloud welcome email

* Feedback impl-2

* Fix template

* Temp undo

* Update

* make i18n-extract

* Translations

* Feedback impl-3

* More template fixes

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-03-10 20:39:21 +03:00
Claudio Costa
8612f3a4d1 Fix panic (#17055)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-03-09 18:05:47 +01:00
Mario de Frutos Dieguez
5203fc8608 [MM-28694] Add MM User information in the CWS request headers (#15824)
* Include user data in the cloud endpoints

Those headers will include the user ID and Email so we can use them
in CWS

* Removed AppError from enterprise/cloud

We're removing the AppError from all the places that don't belong
to the app or api4 packages.

* Remove unused i18n strings

* Move it to the server init of enterprise

Also moved the initialization of the enterprise part in the server after the store is initialized

* Initialize after the store is set in NewServer

The ideal way to do it should be to move the initEnterprise call after
the store is set but that would lead to undesired side-effects so we
initialize the cloud part alone.

Signed-off-by: Mario de Frutos <mario@defrutos.org>
2021-03-05 09:23:39 +01:00
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
Eli Yukelzon
4aa6c863c3 MM-30304 - Handle collapsed threads in page apis (#17064) 2021-03-05 09:46:36 +02:00
Eli Yukelzon
c64959b439 MM-31105 /Join <channel name> is case sensitive (#16903)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-03-03 10:44:18 +02:00
Eli Yukelzon
23d51ed1f2 MM-32655 - Collapsed threads websocket handling (#16909)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-03-02 16:49:00 +02: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
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
Miguel de la Cruz
d7571b401b Fixes error message when creator_id is not set (#16998) 2021-02-24 20:47:12 +03:00
Allan Guwatudde
0dad204007 [MM-32691] - Send email when the users are not able to join a workspace (#16958)
* [MM-32691] - Send email when the users are not able to join a workspace

* Revert "[MM-32691] - Send email when the users are not able to join a workspace"

This reverts commit 3c11643c7c.

* Feeback impl-1

* use date as key for rate limiting

* Fix tests

* Translations

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-02-24 17:37:24 +03:00
Claudio Costa
7b8cff1962 Improve error (#16967) 2021-02-18 15:37:38 +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
31a80a5351 Replacing require.nil in api layer (#16906)
* Replacing require.nil in api layer

* Fixing some tests

* Fixing tests

* Addressing PR review comments

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-02-17 09:52:18 +01:00
Agniva De Sarker
9992a27a90 Revert "MM-24530-Add support for search terms with underscore using postgresql engine (#16618)" (#16950)
This reverts commit ba3b788e46.
2021-02-17 13:52:15 +05:30
Allan Guwatudde
3f3abc3f3d [MM-32543] - Add ability to send email to admin that users are trying to invite others (#16882)
* [MM-32543] - Add ability to send email to admin that users are trying to join

* Update email template

* Feedback impl-1

* Fix test

* Feedback impl-2

* Fix error

* Feedback impl

* Use 413 status code

* make i18n-extract

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-02-16 15:03:08 +03:00
Eli Yukelzon
830594004b MM-32652 /threads?unread=true returns null threads and no counts if there are no unread threads (#16885)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-02-15 15:42:05 +02: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
Agniva De Sarker
a246104d04 MM-21012: Revamp websocket implementation (#16620)
* MM-21012: Revamp websocket implementation

We replace the old gorilla/websocket implementation with the
gobwas/ws library. The gorilla library was in maintenance mode
and had a high level API due to which we cannot use that for
situations where a large number of concurrent connections needs
to be supported.

The ws library is a very low-level library that allows us
to work with raw net.Conns. We make several improvements:

- We completely remove the reader goroutines, and instead
replace them with a manual epoll implementation which sends off
messages to be read when it receives any data on the connection.
This lets us scale to a much larger number of connections.
- The reader buffer is eliminated, because we directly read
from the connection now.

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

```release-notes
Improved the websocket implementation by using epoll manually
to read from a websocket. As a result, the number of goroutines
is expected to go down by half.
```

* fix tests

* fix shadowing errors

* final changes

* windows support!

* Remove pointer to waitgroup

* Fix edge case

* Trigger CI

* Trigger CI

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-02-13 23:42:11 +05:30
Leats
82e001d107 Allow 'mmctl channel move' to move private channels (#16433) 2021-02-11 17:26:56 +01:00
Pablo Andrés Vélez Vidal
b3fad842fd MM31503 - screen to restrict access bcs workspace capacity (#16896)
Co-authored-by: Pablo Velez Vidal <pablo.velez@mattermost.com>
2021-02-10 20:46:20 +01:00
Mahmudul Haque
7dd4d4859b unparam lint (#16865)
Automatic Merge
2021-02-09 18:52:27 +01:00
Claudio Costa
572f861675 [MM-31247] Add support for compressed export files with attachments (#16614)
* Include filepaths for post attachments

* Cleanup

* Enable exporting file attachments

* Fix file import

* Enable zip export

* Support creating missing directories when unzipping

* Add test

* Add translations

* Export direct channel posts attachments

* Fix returned values order

Remove pointer to slice in return

* [MM-31597] Implement export process job (#16626)

* Implement export process job

* Add translations

* Remove unused value

* [MM-31249] Add /exports API endpoint (#16633)

* Implement API endpoints to list, download and delete export files

* Add endpoint for single resource

* Update i18n/en.json

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

* Update i18n/en.json

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

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

* Fix var name

Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
2021-02-09 11:58:31 +01:00
Eli Yukelzon
9a33c3706a MM-32525 Incorrect number of mentions for channels when threads are enabled (#16853) 2021-02-09 12:03:32 +02:00
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
Allan Guwatudde
ddd9439706 [MM-31497] - Prevent end users from inviting people and exceeding the free tier limits (#16786)
* [MM-31497] - Prevent end users from inviting people and exceeding the free tier limits

* Update error

* Commit forgotten code

* Chnage impl-1

* Change impl-2

* Remove test

* Include tier status

* Renable permissions check

* Change endpoint name

* Update endpoint

* Update api4/cloud.go

Co-authored-by: Maria A Nunez <maria.nunez@mattermost.com>

* Add test for new endpoint

* Format code

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Maria A Nunez <maria.nunez@mattermost.com>
2021-02-03 18:56:40 +03: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
Eli Yukelzon
13616cac0f MM-31711 - Implement cursor paging for threads (#16748)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-01-31 12:28:14 +02:00
Eli Yukelzon
bb7e5b6e9d MM-31712 Server/API: Unreads-only filter for GetUserThreads (#16660)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-01-31 11:54:35 +02:00
Ben Schumacher
c38dd22261 [MM-30292] Don't include prepackaged plugin into Marketplace response for cloud (#16543) 2021-01-31 09:17:46 +01: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
Eli Yukelzon
77da23e84b MM-31713 Server/API: GetUserThread method (#16659)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-01-28 18:07:39 +02:00
Madhav Hugar
94c24eea20 Fix empty string comparison issues in the codebase (#16686)
Automatic Merge
2021-01-25 11:15:17 +01:00
Eli Yukelzon
c2316c15f3 MM-32027 - Marking a thread as unread not possible or marks all threads as unread. (#16757)
* mark thread as read query fix

* test fix

* lint
2021-01-24 11:37:09 +02:00
Agniva De Sarker
1aae3444c0 MM-32013: Do not allow password change in /auth endpoint (#16770)
We were allowing new password to be reset without asking
for the old password. This was not advertised but was possible nevertheless
through the API.

Since there is already a separate API to change password, we choose to remove
this functionality.

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

```release-note
The /api/v4/users/me/auth API endpoint cannot be used to change password anymore.
This was a hidden feature that was not documented, but was nevertheless possible.
We are just removing the hidden feature.
```

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-01-22 09:58:08 +05:30
Agniva De Sarker
dccdc9f6cf MM-31721: Fix Cache-Control directives (#16763)
We were incorrectly setting the cache control to public
when it should be rather private.

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

```release-notes
Fix Cache-Control headers to instruct that responses may only be cached
on browsers.
```
2021-01-21 12:38:49 +01:00
Allan Guwatudde
a7e212566d [MM-31112] - Update license renewal email (#16747)
* [MM-31112] - Update license renewal email

* Feedback impl-1

* Update app/license.go

Co-authored-by: Maria A Nunez <maria.nunez@mattermost.com>

* Feedback impl-2

Co-authored-by: Maria A Nunez <maria.nunez@mattermost.com>
2021-01-20 19:57:29 +03:00
Ibrahim Serdar Acikgoz
11c6d07d6a [MM-31404] api4/config: return error when patching PluginSettings.EnableUploads (#16611)
* api4/config: return error when patching PluginSettings.EnableUploads

* reflect review comments

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-01-20 14:45:21 +03:00
Antwi Gambrah
ba3b788e46 MM-24530-Add support for search terms with underscore using postgresql engine (#16618)
* add support for search terms with underscore using postgresql

* fix failing tests

Initially issue fix applied to all search terms instead of the ones that contains _

* direct cast tsquery

* fix test issues

* refactor underscored quoted term search

* support search term case-insensitive

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-01-20 00:10:10 +05:30
Eli Yukelzon
911d1f070e MM-31710 Server/API: change total_unread_replies to total_unread_threads (#16663)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-01-19 13:33:57 +02:00
Eli Yukelzon
b0bddeb5e6 MM-29988 - Update exising Post APIs with collapsed threads (#16503) 2021-01-14 13:46:27 +02:00
Eli Yukelzon
110ac3b1ec MM-30338 Add feature flag for collapsedthreads (#16598)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-01-13 12:42:35 +02:00
Hossein
4d5ca92a04 [MM-28000] Fix system manager can download export files without right permissions (#16569)
Automatic Merge
2021-01-12 20:45:17 +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