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 ```
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
27559c1c7b
Коммит
a850704afe
@@ -106,7 +106,7 @@ func TestPluginCommand(t *testing.T) {
|
||||
require.NotEqual(t, "plugin", commands.Trigger)
|
||||
}
|
||||
|
||||
th.App.RemovePlugin(pluginIDs[0])
|
||||
th.App.ch.RemovePlugin(pluginIDs[0])
|
||||
})
|
||||
|
||||
t.Run("re-entrant command registration on config change", func(t *testing.T) {
|
||||
@@ -207,7 +207,7 @@ func TestPluginCommand(t *testing.T) {
|
||||
killed = true
|
||||
}
|
||||
|
||||
th.App.RemovePlugin(pluginIDs[0])
|
||||
th.App.ch.RemovePlugin(pluginIDs[0])
|
||||
require.False(t, killed, "execute command appears to have deadlocked")
|
||||
})
|
||||
|
||||
@@ -285,7 +285,7 @@ func TestPluginCommand(t *testing.T) {
|
||||
require.Equal(t, model.CommandResponseTypeEphemeral, resp.ResponseType)
|
||||
require.Equal(t, "text", resp.Text)
|
||||
|
||||
th.App.RemovePlugin(pluginIDs[0])
|
||||
th.App.ch.RemovePlugin(pluginIDs[0])
|
||||
})
|
||||
t.Run("plugin has crashed before execution of command", func(t *testing.T) {
|
||||
tearDown, pluginIDs, activationErrors := SetAppEnvironmentWithPlugins(t, []string{`
|
||||
@@ -329,7 +329,7 @@ func TestPluginCommand(t *testing.T) {
|
||||
require.Nil(t, resp)
|
||||
require.NotNil(t, err)
|
||||
require.Equal(t, err.Id, "model.plugin_command_error.error.app_error")
|
||||
th.App.RemovePlugin(pluginIDs[0])
|
||||
th.App.ch.RemovePlugin(pluginIDs[0])
|
||||
})
|
||||
|
||||
t.Run("plugin has crashed due to the execution of the command", func(t *testing.T) {
|
||||
@@ -374,7 +374,7 @@ func TestPluginCommand(t *testing.T) {
|
||||
require.Nil(t, resp)
|
||||
require.NotNil(t, err)
|
||||
require.Equal(t, err.Id, "model.plugin_command_crash.error.app_error")
|
||||
th.App.RemovePlugin(pluginIDs[0])
|
||||
th.App.ch.RemovePlugin(pluginIDs[0])
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user