* Updates getProfilesAndStatusesForPosts to fetch nonexisting custom groups
* Fix linter
* Rename method
* Adds an action test
* Using a set on loadedProfiles instead of an array
There were multiple problems with loading of a license.
1. It was called from inside app/server.go and app/platform/service.go. The first one wasn't really needed anymore, so we remove it.
2. To make loading of a license work across a cluster, the license load action was attached along with the `InvalidateAllCachesSkipSend` method. But the problem with that was that it would even get called in the caller node as well, putting it in a recursive loop.
```
LoadLicense -> SaveLicense -> InvalidateAllCaches -> InvalidateAllCachesSkipSend -> LoadLicense
```
To fix this, we create a dedicated loadLicense cluster event and move it away from the `InvalidateAllCachesSkipSend` method. And then from the caller side, we just trigger this action.
3. We also remove the first call to check license expiration which would load the license again. This is unnecessary because if the license is expired, server wouldn't start at all.
While here, we also make some other improvements like removing unnecessary goroutine spawning while publishing websocket events. They are already handled asynchronously, so there is no need
to create a goroutine for that.
We also remove
```
ps.ReloadConfig()
ps.InvalidateAllCaches()
```
from requestTrialLicense as they are already called from inside `*PlatformService.SaveLicense`.
And lastly, we remove the `*model.AppError` return from `*PlatformService.InvalidateAllCaches` because there was nothing to return at all.
https://mattermost.atlassian.net/browse/MM-53879
```release-note
Fix several issues with loading of a license
```
Include https://github.com/mattermost/mattermost-plugin-api into the mono repo
Co-authored-by: Jesse Hallam <jesse.hallam@gmail.com>
Co-authored-by: Michael Kochell <mjkochell@gmail.com>
Co-authored-by: Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
Co-authored-by: Alex Dovenmuehle <alex.dovenmuehle@mattermost.com>
Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>
Co-authored-by: Christopher Poile <cpoile@gmail.com>
Co-authored-by: İlker Göktuğ Öztürk <ilkergoktugozturk@gmail.com>
Co-authored-by: Shota Gvinepadze <wineson@gmail.com>
Co-authored-by: Ali Farooq <ali.farooq0@pm.me>
Co-authored-by: Maria A Nunez <maria.nunez@mattermost.com>
Co-authored-by: Daniel Espino García <larkox@gmail.com>
Co-authored-by: Christopher Speller <crspeller@gmail.com>
Co-authored-by: Alex Dovenmuehle <adovenmuehle@gmail.com>
Co-authored-by: Szymon Gibała <szymongib@gmail.com>
Co-authored-by: Lev <1187448+levb@users.noreply.github.com>
Co-authored-by: Jason Frerich <jason.frerich@mattermost.com>
Co-authored-by: Agniva De Sarker <agnivade@yahoo.co.in>
Co-authored-by: Artur M. Wolff <artur.m.wolff@gmail.com>
Co-authored-by: Madhav Hugar <16546715+madhavhugar@users.noreply.github.com>
Co-authored-by: Joe <security.joe@pm.me>
Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
Co-authored-by: José Peso <trilopin@users.noreply.github.com>
* add NotificationWillBePushed hook
* mocks
* use a struct for hook parameters; simplify number of parameters sent across RPC
* missing wg.Wait
* change to a bool return value
* [MM-32576] Text copied from Microsoft OneNote pastes as an image
* [MM-32576] Text copied from Microsoft OneNote pastes as an image (linter and tests fix)
* [MM-32576] Text copied from Microsoft OneNote pastes as an image (E2E tests fix: mock clipboardData.getData())
---------
Co-authored-by: Andrey Karavashkin <akaravashkin@stsoft.ru>
* move plugin signature verification to caller
The semantics for when plugin signature validation is required are unique to the caller, so move this logic there instead of masking it, thus simplifying some of the downstream code.
* support transitionally prepacked plugins
Transitionally prepackaged plugins are prepackaged plugins slated for unpackaging in some future release. Like prepackaged plugins, they automatically install or upgrade if the server is configured to enable that plugin, but unlike prepackaged plugins they don't add to the marketplace to allow for offline installs. In fact, if unlisted from the marketplace and not already enabled via `config.json`, a transitionally prepackaged plugin is essentially hidden.
To ensure a smooth transition in the future release when this plugin is no longer prepackaged at all, transitionally prepackaged plugins are persisted to the filestore as if they had been installed by the enduser. On the next restart, even while the plugin is still transitionally prepackaged, the version in the filestore will take priority. It remains possible for a transitionally prepackaged plugin to upgrade (and once again persist) if we ship a newer version before dropping it altogether.
Some complexity arises in a multi-server cluster, primarily because we don't want to deal with multiple servers writing the same object to the filestore. This is probably fine for S3, but has undefined semantics for regular filesystems, especially with some customers backing their files on any number of different fileshare technologies. To simplify the complexity, only the cluster leader persists transitionally prepackaged plugins.
Unfortunately, this too is complicated, since on upgrade to the first version with the transitionally prepackaged plugin, there is no guarantee that server will be the leader. In fact, as all nodes restart, there is no guarantee that any newly started server will start as the leader. So the persistence has to happen in a job-like fashion. The migration system might work, except we want the ability to run this repeatedly as we add to (or update) these transitionally prepackaged plugins. We also want to minimize the overhead required from the server to juggle any of this.
As a consequence, the persistence of transitionally prepackaged plugins occurs on every cluster leader change. Each server will try at most once to persist its collection of transitionally prepackaged plugins, and newly started servers will see the plugins in the filestore and skip this step altogether.
The current set of transitionally prepackaged plugins include the following, but this is expected to change:
* focalboard
* complete list of transitionally prepackaged plugins
* update plugin_install.go docs
* updated test plugins
* unit test transitionally prepackged plugins
* try restoring original working directory
* Apply suggestions from code review
Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>
* clarify processPrepackagedPlugins comment
---------
Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>
This got missed out in the initial PR review.
There's been only one instance of this, and that too in a spinwick
so it's not widepsread. We will cp this if we see more crashes.
https://mattermost.atlassian.net/browse/MM-54158
```release-note
NONE
```
Somewhere in the build pipeline, we run `make config-reset` to generate a default `config.json` to include with the tarball. Unfortunately, this was being built without the `-tags production` signal that changes the default service environment to `production`, and in turn caused the `CWS` environment to default to testing. The trial licenses returned by the testing environment aren't compatible with the production environment, preventing new customers from starting trials by themselves.
As an immmediate workaround, customers can simply delete the `config.json` included with the tarball and start the server anew. Without any further configuration, it will correctly default to the `production` service environment and use the correct `CWS` environment.
Fix the tarball generation by adding `-tags production` to the `config-reset` Makefile target. We don't add a dev version of this for now, as it's not really needed given the server creates the right value on startup.
Fixes: https://mattermost.atlassian.net/browse/CLD-6137
- Prevents commands from receiving potential whitespace characters
- Adds a new root test case ensuring various whitespace characters are removed
Co-authored-by: Nathan Geist <ngeist@spiria.com>
After reliable websockets were introduced,
we would keep pushing to a webConn even after
the client has disconnected. This would lead
to the websocket.slow/full and eventually
the disconnect messages which unnecessarily
confuse the admin.
We don't log them if the connection is inactive.
We use the active field and convert it to an atomic
to use more widely.
```release-note
NONE
```
* Update group_store.go
Replace raw SQL with query builder for Get, Update, and Delete methods in GroupStore
* Update group_store.go
Replace raw SQL with query builder for GetByRemoteID, GetAllBySource, and Restore methods in GroupStore
* Add error handling when using query builder in group_store.go
* Use builder methods to cut down on boilerplate
* Update server/channels/store/sqlstore/group_store.go
Implement suggestion from PR review
Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
---------
Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
* remove boards data-retention
* remove another variable
* update snapshots, to remove boards
* need to keep config settings until focalboard is updated
---------
Co-authored-by: Mattermost Build <build@mattermost.com>