Add back enable/disable WS events (#9052)

Этот коммит содержится в:
Joram Wilander
2018-07-05 10:23:55 -04:00
коммит произвёл Christopher Speller
родитель 83a3ac089c
Коммит 7bfb5aec26
3 изменённых файлов: 21 добавлений и 1 удалений

Просмотреть файл

@@ -170,6 +170,12 @@ func (a *App) EnablePlugin(id string) *model.AppError {
cfg.PluginSettings.PluginStates[id] = &model.PluginState{Enable: true}
})
if manifest.HasClient() {
message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_PLUGIN_ENABLED, "", "", "", nil)
message.Add("manifest", manifest.ClientManifest())
a.Publish(message)
}
// This call will cause SyncPluginsActiveState to be called and the plugin to be activated
if err := a.SaveConfig(a.Config(), true); err != nil {
if err.Id == "ent.cluster.save_config.error" {
@@ -208,6 +214,12 @@ func (a *App) DisablePlugin(id string) *model.AppError {
cfg.PluginSettings.PluginStates[id] = &model.PluginState{Enable: false}
})
if manifest.HasClient() {
message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_PLUGIN_DISABLED, "", "", "", nil)
message.Add("manifest", manifest.ClientManifest())
a.Publish(message)
}
if err := a.SaveConfig(a.Config(), true); err != nil {
return model.NewAppError("DisablePlugin", "app.plugin.config.app_error", nil, err.Error(), http.StatusInternalServerError)
}