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>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
a28183b078
Коммит
9bf94bf6c1
@@ -130,6 +130,23 @@ func (ch *Channels) syncPluginsActiveState() {
|
||||
}
|
||||
|
||||
if pluginEnabled {
|
||||
// Disable focalboard in product mode.
|
||||
if pluginID == model.PluginIdFocalboard && ch.cfgSvc.Config().FeatureFlags.BoardsProduct {
|
||||
msg := "Plugin cannot run in product mode. Disabling."
|
||||
mlog.Warn(msg, mlog.String("plugin_id", model.PluginIdFocalboard))
|
||||
|
||||
// This is a mini-version of ch.disablePlugin.
|
||||
// We don't call that directly, because that will recursively call
|
||||
// this method.
|
||||
ch.cfgSvc.UpdateConfig(func(cfg *model.Config) {
|
||||
cfg.PluginSettings.PluginStates[pluginID] = &model.PluginState{Enable: false}
|
||||
})
|
||||
pluginsEnvironment.SetPluginError(pluginID, msg)
|
||||
ch.unregisterPluginCommands(pluginID)
|
||||
disabledPlugins = append(disabledPlugins, plugin)
|
||||
continue
|
||||
}
|
||||
|
||||
enabledPlugins = append(enabledPlugins, plugin)
|
||||
} else {
|
||||
disabledPlugins = append(disabledPlugins, plugin)
|
||||
@@ -438,6 +455,10 @@ func (ch *Channels) enablePlugin(id string) *model.AppError {
|
||||
return model.NewAppError("EnablePlugin", "app.plugin.not_installed.app_error", nil, "", http.StatusNotFound)
|
||||
}
|
||||
|
||||
if id == model.PluginIdFocalboard && ch.cfgSvc.Config().FeatureFlags.BoardsProduct {
|
||||
return model.NewAppError("EnablePlugin", "app.plugin.product_mode.app_error", map[string]any{"Name": model.PluginIdFocalboard}, "", http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
ch.cfgSvc.UpdateConfig(func(cfg *model.Config) {
|
||||
cfg.PluginSettings.PluginStates[id] = &model.PluginState{Enable: true}
|
||||
})
|
||||
|
||||
Ссылка в новой задаче
Block a user