From 7bfb5aec26c6bb8c49fa19e8347bc91acc86fe92 Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Thu, 5 Jul 2018 10:23:55 -0400 Subject: Add back enable/disable WS events (#9052) --- app/plugin.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'app/plugin.go') diff --git a/app/plugin.go b/app/plugin.go index af4bae649..d68579311 100644 --- a/app/plugin.go +++ b/app/plugin.go @@ -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) } -- cgit v1.2.3-1-g7c22