* [MM-40407] - Do not show the Renew Now if the license id does not exist in the portal
* improvements
* impl mock
* fix translations
* feedback impl
* fix typo
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* MM-40469: Handle invalid response codes from plugins
This was an interesting crash detected via Sentry.
Typically, any HTTP status code outside 100-999 range
will cause a crash in the HTTP server. And `ExecuteCommand`
is the only plugin hook which returns a model.AppError
instead of error.
So an incorrect plugin implementation could return
a status code of 0, and crash the server. We handle that
by rewriting any illegal response code to 500.
https://mattermost.atlassian.net/browse/MM-40469
```release-note
NONE
```
* added warning
```release-note
NONE
```
* Add playbooks related permissions.
* Add RolesGrantPermission to pluginapi
* Fixing scopes.
* New defaults.
* Fix defaults
* Fix tests.
* Fix migration.
* More test and migration fixes.
* Need to add everything to system admin too.
* Move to 63
* Feedback fixes.
* Fix system manager editing playbook permissions.
* Enable receiving binary websocket messages
* Improve error message
* Prefer anonymous declaration
* Simplify
* Improve test
* Use MessagePack to clone WebSocketRequest struct
* Use short form
* Fix test
* Move enterprise features under Channels
We move the EE features which are Channels related.
While here, we also move some code under *Server.Start()
from NewServer.
```release-note
NONE
```
* move saml and ldap back to server
```release-note
NONE
```
* fix test
```release-note
NONE
```
* try again
```release-note
NONE
```
Summary
The addition of the TotalMsgCountRoot and MsgCountRoot columns to support CRT caused several issues with previously read threads and channels being marked as unread. Previously we attempted to fix this purely in a SQL migration [MM-35345][MM-35494] fixes for incorrect mentions and unreads for threads and channels #17803 but that turned out to be too heavy and it was decided to break up some of the fixes into async jobs.
This PR implements an async job to mark channels as read if there are no user posts since the last time the user viewed the channel.
Ticket Link
https://mattermost.atlassian.net/browse/MM-37013
* MM-39612: Make acquiring and removing connections atomic
The reconnect phase of a websocket was split into two parts:
one where we check if a connection with a given connectionID
exists or not. And second, where we remove that connection
and insert the new connection again in the index.
This would lead to a race where it would be possible
for 2 concurrent requests for the same connectionID to go through
which would lead to separate goroutines working on the same dead queue.
We simplify this by removing the connection from the index
in the check connection stage itself. And then just add that
during register phase.
And to distinguish between a fresh and an old connection, we add
a new field called reuseCount.
While here, we also cleanup some old comments and add more
in some places.
https://mattermost.atlassian.net/browse/MM-39612
```release-note
NONE
```
* remove unused method
```release-note
NONE
```
* race test
```release-note
NONE
```
* CRT changes
* Lint fix
* Moved postId check
* Moved postId check
* Lint fix
* Misc
* Added test case for badge count while clearing notifications
* Fixed count when CRT is on and added isCRTEnabled, teamId to isIdLoaded notifications
* test fix
* isCRTEnabledForUser capitalised
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* Move pluginCommands into Channels
We move pluginCommands, pluginCommandsLock
into Channels.
We also move the plugin related route handlers
under Channels and move the init code under
NewChannels. To achieve this, the router initialization
is bumped up.
Along with it, we clean up some App methods
which were just wrappers over Channel methods.
Instead, we call the Channel method directly
to make things more readable and easy to understand.
```release-note
NONE
```
* fix tests
```release-note
NONE
```
* add missing client for custom user status
* add custom user status plugin api
* update based on feedback review
* add GetCustomStatus
* update interfaces
* Create an endpoint for listing roles
* Add function to client model
* Create tests for listing roles endpoint
* Apply code review suggestions
* Restore GetAllRoles app method
* Use AppContext instead of App
* Minor fix
* Refactor according to new changes
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* Move plugins under Channels
We move all plugin related fields under *Channels.
This essentially migrates several methods from being under
*Server to under *Channels.
We also move the plugin startup and shutdown code
to be under Channels.Start and Channels.Shutdown.
While here, we remove the getPluginPublicKeyFiles
method which was a one-line method which uselessly
returned an error.
Lastly, we fix the product initialization order which
was incorrect previously. Products are dependent on
the main server.
So startup should be products -> server.
And shutdown should be server -> products.
```release-note
NONE
```
* Added app layer
```release-note
NONE
```
* Incorporate suggestions
```release-note
NONE
```
* MM-39420: Checks for presence of slice before index access.
* MM-39420: Sanitize all embeds with single method.
* MM-39420: Already checking len in method.
* Fix PluginHealthCheckJob
We were incorrectly calling to start PluginHealthCheckJob
without initializing the plugins environment.
To fix this, we move the code inside initPlugins right after
the environment is initialized.
To respond to config changes, we call it again from pluginsEnvironment.Shutdown
which gets called from ConfigListener when plugins are disabled. And initPlugins
is anyways called again from ConfigListener which plugins are enabled,
so we can avoid checking for PluginSettings.Enable again in the call.
We also rename the method to better indicate its nature.
During this, we also uncover and fix another bug where disabling
plugins would not shut down plugins at all because we were calling
s.GetPluginsEnvironment() directly which returns nil if plugins
were disabled. The approach we follow is to manually acquire the lock
whenever we need access to the struct ignoring config setting.
We fix that as well.
https://community-daily.mattermost.com/boards/workspace/zyoahc9uapdn3xdptac6jb69ic/285b80a3-257d-41f6-8cf4-ed80ca9d92e5/495cdb4d-c13a-4992-8eb9-80cfee2819a4?c=6ef6178c-3512-4e57-8edd-1d2b66a09c9e
```release-note
NONE
```
* Fix test
```release-note
NONE
```
When configured in a master/slave database environment, a read replica can sometimes return stale data to a `WebConn`, resulting in the user missing out on websocket events targetting that channel until the `WebConn` cache expires.
This is most easily reproducible by using Playbooks on community and starting a new run. The owner, or any automatically invited participants, typically find the websocket events dropped in that channel for up to 30 minutes, even after multiple page refreshes.
I've reproduced this locally, and while I've extended the unit tests, I note that they don't actually exercise this case given the need for a dedicated slave database during unit tests.
Fixes: https://mattermost.atlassian.net/browse/MM-39524
* MM-37934: supports channel override for CRT notifications
Users with CRT 'ON' are enabled to override global CRT notification
settings per channel basis.
* Fixes brain freeze :o
* Fix push notification for CRT
* Some refactor and comments as per review comments
* Minor refactor
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* Show private channels in autocomplete
This is supported in all Engines:
MySQL, Postgres, Bleve, Elasticsearch.
https://mattermost.atlassian.net/browse/MM-18496
```release-note
Private channels will now appear in channel autocomplete.
If you are using Bleve or ElasticSearch, you will have to reindex
the channels again to populate them with the new attributes.
```
A large chunk of this work has been based on the earlier
effort at https://github.com/mattermost/mattermost-server/pull/17804.
Full credit goes to https://github.com/arvinDarmawan.
* Add comment
```release-note
NONE
```
* Adding more tests
```release-note
NONE
```
* fix more tests
```release-note
NONE
```
* tmp
```release-note
NONE
```
* more fixes
```release-note
NONE
```
* add tests
```release-note
NONE
```
* Add review comments from previous PR
```release-note
NONE
```
* Add API to return all channels from all team
```release-note
NONE
```
* Added support for bleve and ES
```release-note
NONE
```
* Streaming response for GetAllChannels
```release-note
NONE
```
* Fix tests
```release-note
NONE
```
* Trigger CI
```release-note
NONE
```
* fix tests
```release-note
NONE
```
* Addressing review comments
```release-note
NONE
```
* Fix lint
```release-note
NONE
```
* Removing flaky test
```release-note
NONE
```
* Address comments
```release-note
NONE
```
* Trigger CI
```release-note
NONE
```
* Added /users/<userid>/channel_members endpoint
```release-note
NONE
```
* Minor edit
```release-note
NONE
```
* Improve embedding
```release-note
NONE
```
* Fix lint error
```release-note
NONE
```
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
* Move some more atomic values under Channels
The following fields were moved:
```
asymmetricSigningKey atomic.Value
clientConfig atomic.Value
clientConfigHash atomic.Value
limitedClientConfig atomic.Value
```
And also moved the initialization order from NewServer
to Channels.Start to better reflect the order of things.
Removed AsymmetricSigningKey from ConfigService
as it was no longer used.
Removed calling regenerateClientConfig during startup explicitly
because it was anyways called from ensureAsymmetricSigningKey.
https://community-daily.mattermost.com/boards/workspace/zyoahc9uapdn3xdptac6jb69ic/285b80a3-257d-41f6-8cf4-ed80ca9d92e5/495cdb4d-c13a-4992-8eb9-80cfee2819a4?c=87df1e15-588e-49ff-8bd1-ffa9651b8c82
```release-note
NONE
```
* Fix lint error
```release-note
NONE
```
* [MM-39053] - A/B test for default notification settings
* fix tests
* first name notifications on
* update
* Fix bad merge alignment
Co-authored-by: Maria A Nunez <maria.nunez@mattermost.com>
- Make it a Server method.
- Pass Server instead of App.
- Remove global app instance from NewServer, rather
create local instances whenever needed.
- Remove App from Websocket router, and create dynamically
on every request.
- Remove HubStart and HubStop from App methods.
- Explicitly using s.Log instead of the global logger
to indicate dependency on Server. We could have passed the logger
explicitly but it doesn't look ideal.
```release-note
NONE
```