Граф коммитов

114 Коммитов

Автор SHA1 Сообщение Дата
Ibrahim Serdar Acikgoz
617c024476 app: avoid plugin env check for RunMultiHook and use pluginslock while accessing plugin env (#21803)
* app/channels: use pluginslock while accessing plugins environment

* when using RunMultiHook we don't need to do a nil check on plugin env

* trigger ci
2022-12-07 10:00:47 +03:00
Michael Kochell
c3c81cb3d6 MM-48120/MM-48623 Patch plugin bundle react-dom on webapp extract (#21171)
Automatic Merge
2022-12-06 19:44:48 +02:00
Ibrahim Serdar Acikgoz
43e26ccda2 MPA: move product hooks out of plugins environment (#21772)
* product: add new hooks manager for porducts

* move product hooks out of plugins environment

* add hooks for plugin
2022-12-05 20:16:35 +01:00
Ibrahim Serdar Acikgoz
372653a921 Revert "app/pluginservice: move plugin out from the Channels product (#21697)" (#21725)
This reverts commit 6c55c4d356.
2022-11-24 19:22:36 +05:30
Ibrahim Serdar Acikgoz
6c55c4d356 app/pluginservice: move plugin out from the Channels product (#21697) 2022-11-24 11:13:29 +03:00
Javier Aguirre
7f419ea091 [MM-48542] Removing integration limits (#21282)
* Removing integration limits

* Remove freemium limit test

* Remove test assertion regarding cloud limits

* Remove GetIntegrationsUsage

* Removing integrations usage notifications

* This shouldn't be removed

* Removing client call and websocket event

* Remove old translations

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-11-23 10:42:23 +01:00
Shota Gvinepadze
9f9e19e05d [MM-48161] Change data types for collections and topics (#21634)
* Change data types for collections and topics

* Address suggestions

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-11-15 00:57:04 +04:00
Shota Gvinepadze
b8da473da7 [MM-47542] Extend Plugin API (#21446)
* Extend Plugin API

* Use Error, NoError in tests

* Address suggestions

* Simplify code

* Add new line

* Add featureflag and GetCollectionMetadataByIds hook

* Add enter at the end of file

* make build-templates

* Fix test

* Fix GetCollectionMetadataByIds ret type

* Add GetTopicMetadataByIds hook

* Add log

* Extract i18n

* Add experimental notice on hooks

* Update model/feature_flags.go

* Swap user to userId

* Change userId to userID

Co-authored-by: Jesse Hallam <jesse.hallam@gmail.com>
2022-11-03 22:43:30 +04:00
Nick Misasi
a541cda9d0 Invalidate cloud caches when a new license is loaded (#21579)
Automatic Merge
2022-11-02 22:40:26 +02:00
Harrison Healey
b316e1384e Change status code to 400 when attempting to enable Boards plugin with product enabled (#21521) 2022-10-26 18:15:19 -04:00
Agniva De Sarker
9bf94bf6c1 MM-47249: Blocklist focalboard plugin in product mode (#21243)
We prevent the plugin from starting if in product mode,
and also give pretty errors to make it clear to the users.

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

```release-note
NONE
```

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-10-08 10:21:22 +05:30
Ibrahim Serdar Acikgoz
5e69c6b02f Move cluster, webhub and store out of Server (#20899) 2022-10-06 11:04:21 +03:00
Kyriakos Z
c11ad8995f Adds OmitConnection parameter to broadcast (#20723)
* Adds OmitConnection parameter to broadcast

Currently we have no means to omit sending a websocket event to a
specific connection id.
This is needed mainly so that the initiator won't receive an event for
the action it just initiated.
Will be used for the global drafts feature, so that we won't update
drafts through ws when a user is typing.

This commit adds OmitConnection to the Broadcast struct and to the
NewWebSocketEvent function signature.
shouldSendEvent should return false for that specific connection.

* Return early only if connection id matches the omitted

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-09-02 13:17:22 +03:00
Ibrahim Serdar Acikgoz
efbcb0a35a move logger under platform (#20831)
* move logger under platform
2022-08-24 10:10:56 +03:00
Tim Scheuermann
a28a967eba MM-45991 Wrap errors (#20785) 2022-08-18 11:01:37 +02:00
Tim Scheuermann
b4570afa90 Replace deprecated ioutil with io and os (#20776)
* Replace ioutil with io and os

* Replace ioutil in utils/file.go

* Minor fix to tests and excluded files

Co-authored-by: Tim Scheuermann <tim.scheuermann@mattermost.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-08-09 14:25:46 +03:00
Ibrahim Serdar Acikgoz
ac79a887a2 Move metrics under platform service (continued) (#20732)
* move metrics into platform

Co-authored-by: Agniva De Sarker <agnivade@yahoo.co.in>
2022-08-02 10:59:29 +03:00
Doug Lauder
2aaf4cf0fb Fix broken master; ensure all product service APIs have correct implementations (#20663)
* fix broken master; ensure all product service APIs are implemented by the structs passed to products

* use zero allocation interface checks
2022-07-15 13:20:40 -04:00
Claudio Costa
159ebc297d Pre-package Calls v0.6.0 and enable it by default (#20388)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-06-07 19:45:43 +02:00
Ibrahim Serdar Acikgoz
c1c084a596 app/plugin: add product middleware and enable products register their routers (#20374) 2022-06-07 09:12:15 +03:00
Michael Kochell
ea5bfe3fd9 Cloud Freemium - Integrations (#20185)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-05-25 12:36:08 -04:00
Claudio Costa
aee68c7ae4 [MM-44056] Make Calls plugin's state on Cloud controllable by feature flag (#20161)
* Make Calls plugin's state on Cloud controllable by feature flag

* Prepackage Calls v0.4.9 (#20148)

* Update app/plugin.go

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

* Update app/plugin_install.go

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

* Bump Calls version to latest

Co-authored-by: Jesse Hallam <jesse.hallam@gmail.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-05-10 19:29:48 +02:00
Guillermo Vayá
4bf3d6a7f5 [MM-40179] Go into directories when trying to export attachments (#19249)
* MM-40179 traverse directories when trying to export

* fix test

* fix s3 to behabe the same way

* add test for paths way too deep

* test recursion only on localstorage

* make list directories non recursively the default approach

* fix linting error

* fix non-recursive case

Co-authored-by: = <=>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-03-15 12:57:29 +01:00
Agniva De Sarker
dbf779b828 MM-40813: Add config interface (#19571)
We create the basic boilerplate to pass services
to each product. The basic idea is to have a map
containing service names and the services.

The server will pass all services to all products.
But it is on the product, to choose what services
they will actually consume.

Each product will cast the received service to
an interface with the methods that product requires.

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

```release-note
NONE
```
2022-02-21 21:41:04 +05:30
Ben Schumacher
321b19e3db [MM-41290] Add Endpoint to complete onboarding (#19435) 2022-02-02 19:45:09 +01:00
Josh Soref
294bd44971 [GH-19267] Spelling comments (#19268)
* spelling: comments

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-01-20 10:07:27 +05:30
Allan Guwatudde
0b1e9445c8 [MM-40682] - SIGSEGV after upgrade from 6.1.0 to 6.2.0 (#19192)
* [MM-40682] - SIGSEGV after upgrade from 6.1.0 to 6.2.0

* feedback impl
2021-12-17 09:39:10 +03:00
Igor German
d3536087d7 Make getPrepackaged resilient to missing plugin icons (#18505)
Signed-off-by: Igor German <germanenak@gmail.com>

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-11-29 14:17:59 -04:00
Agniva De Sarker
a850704afe Move pluginCommands into Channels (#18974)
* 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
```
2021-11-12 10:35:14 +05:30
Agniva De Sarker
25257d6ef6 Move plugins under Channels (#18938)
* 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
```
2021-11-08 11:57:22 +05:30
Agniva De Sarker
83b3090eb9 Fix PluginHealthCheckJob (#18927)
* 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
```
2021-11-04 08:54:03 +05:30
Agniva De Sarker
f0ecdcc5f5 Move Channels into App (#18623)
* Move Channels into App

In this PR, we make Channels as part of App
instead of Server. This is part of the transition period
of moving fields from Server to Channels.

For now, Channels contains Server. So the hierarchy is

App -> Channels -> Server.

And as a first step, we also move httpService to Channels.

```release-note
NONE
```

* Fixing another test

```release-note
NONE
```

* new method

```release-note
NONE
```
2021-10-12 11:39:49 +05:30
Michael Kochell
eaa37b52ee [MM-37494] Check for license SKU when preparing marketplace requests (#18031)
* check for license SKU when preparing marketplace requests

* rename method to HasEnterpriseMarketplacePlugins

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-08-24 14:37:58 -04:00
Ben Schumacher
757dc96461 [MM-37772] Idiomatic naming (URL, URI, API) (#18128)
* s/Url/URL/g & s/Uri/URI/g

* s/Api/API/g
2021-08-16 19:46:44 +02:00
Ben Schumacher
fd853e74a6 [MM-37755] Idiomatic naming (SMTP, TLS, TCP, XML, CSS, HTML, HTTP) (#18103) 2021-08-12 11:49:16 +02:00
Agniva De Sarker
c4b4e1bc38 MM-36271: Bump major version to 6.0 (#17973)
https://mattermost.atlassian.net/browse/MM-36271

```release-note
We bump the major version to 6.0
```
2021-07-22 12:21:47 +05:30
Ben Schumacher
97ccf0bdf6 [MM-16751] golint model (#17896) 2021-07-21 16:38:39 +02:00
Agniva De Sarker
4b95d47923 DB driver implementation via RPC (#17779)
This PR builds up on the pass-through DB driver to a fully functioning DB driver implementation via our RPC layer.

To keep things separate from the plugin RPC API, and have the ability to move fast with changes, a separate field Driver is added to MattermostPlugin. Typically the field which is required to be compatible are the API and Helpers. It would be well-documented that Driver is purely for internal use by Mattermost plugins.

A new Driver interface was created which would have a client and server implementation. Every object (connection, statement, etc.) is created and added to a map on the server side. On the client side, the wrapper structs hold the object id, and communicate via the RPC API using this id.

When the server gets the object id, it picks up the appropriate object from its map and performs the operation, and sends back the data.

Some things that need to be handled are errors. Typical error types like pq.Error and mysql.MySQLError are registered with encoding/gob. But for error variables like sql.ErrNoRows, a special integer is encoded with the ErrorString struct. And on the cilent side, the integer is checked, and the appropriate error variable is returned.

Some pending things:

- Context support. This is tricky. Since context.Context is an interface, it's not possible to marshal it. We have to find a way to get the timeout value from the context and pass it.
- RowsColumnScanType(rowsID string, index int) reflect.Type API. Again, reflect.Type is an interface.
- Master/Replica API support.
2021-06-17 08:53:52 +05:30
Claudio Costa
e1b13c10fc [MM-28692] Include config diffs in audit record for config changing API calls (#17623)
* Replace config generator

* Cleanup

* Some renaming and docs additions to add clarity

* Cleanup logging related methods

* Cleanup emitter

* Fix TestDefaultsGenerator

* Move feature flags synchronization logic out of config package

* Remove unnecessary util functions

* Simplify load/set logic

* Refine semantics and add some test to cover them

* Remove unnecessary deep copies

* Improve logic further

* Fix license header

* Review file store tests

* Fix test

* Fix test

* Avoid additional write during initialization

* More consistent naming

* Update app/feature_flags.go

Co-authored-by: Christopher Speller <crspeller@gmail.com>

* Update config/store.go

Co-authored-by: Christopher Speller <crspeller@gmail.com>

* Update config/store.go

Co-authored-by: Christopher Speller <crspeller@gmail.com>

* Update config/store.go

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

* Make ConfigStore.Set() return both old and new configs

* Implement config diff function

* Make app.SaveConfig return previous and current configs

* Add config diff to audit record

* Fix returned configs

* Include high level test

* Move FF synchronizer to its own package

* Remove unidiomatic use of sync.Once

* Add some comments

* Rename function

* More comment

* Save config diff in audit record for local endpoints

* Enable audit for config set/reset commands

* Improve tests output

Co-authored-by: Christopher Speller <crspeller@gmail.com>
Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
2021-05-21 09:04:39 +02:00
Ibrahim Serdar Acikgoz
5ea06e51d0 Migrate to stateless app.App (#17542)
* add request context

* move initialialization to server

* use app interface instead of global app functions

* remove app context from webconn

* cleanup

* remove duplicated services

* move context to separate package

* remove finalize init method and move content to NewServer function

* restart workers and schedulers after adding license for tests

* reflect review comments

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-05-11 13:00:44 +03:00
Agniva De Sarker
8f9e2669a6 MM-34419: Fix plugin enable race (#17511)
A race happens when we try to enable plugins
in an HA environment. There is no loss in functionality
here, but it's a timing bug.

There are two bugs here.

The first one is a case of nested config listeners. a.InitPlugins
is called in InitServer, and as well as a config listener. And that
calls a.SyncPluginsActiveState(). But inside a.InitPlugins,
there is yet another config listener which again calls
a.SyncPluginsActiveState(). The first fix is to simply not call
the method again from the nested listener.

The second bug happens because the config changed message is sent
across the cluster only after saving the config locally
in the store. To fix this, we simply change GetPluginStatus
to not fail and return empty status when other nodes don't have plugins
enabled.

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

```release-note
Fix a race condition where enabling plugins would result
in spurious errors in the logs.
```
2021-04-30 07:16:57 -07:00
Ben Schumacher
75824257d5 Add missing wrapped errors (#17339) 2021-04-07 10:44:50 +02:00
Daniel Espino García
9d997dbbde Add feature flag for apps (#16851)
* Add feature flag for apps

* Update default to false

* Add plugin version Feature Flag

* Fix typo

* Only force shutdown, and leave the enable status dependant on the user (defaulting to enable)

* Remove unneeded tracking of status

* Handle plugin init on startup for locally installed plugin
2021-03-29 15:53:31 +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
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
SimonSimonB
6fa4c8b8bd [Partial Fix #16623]: Fix initialism errors in codebase. (#16979)
Automatic Merge
2021-02-25 20:22:27 +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 4ee38c3d0bf7bd7d8386f46f0985a0d03245a1d4.

* 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
Ben Schumacher
c38dd22261 [MM-30292] Don't include prepackaged plugin into Marketplace response for cloud (#16543) 2021-01-31 09:17:46 +01:00
Ibrahim Serdar Acikgoz
83d31ec907 [MM-31573] update log levels for the app package (#16629)
* update log levels for the app package

* reflect review comments

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-01-15 09:58:34 +03:00
Christopher Speller
866e938a12 MM-31699 Don't downgrade plugins with feature flag for on-prem (#16639)
* Don't downgrade plugins with feature flag for on-prem

* Update app/plugin.go

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

* Short circut for plugin doesn't exist.

Co-authored-by: Christopher Poile <cpoile@gmail.com>
2021-01-12 09:30:48 -08:00