Changes the event to send when a channel is shared or unshared (#28183)
* Changes the event to send when a channel is shared or unshared Before we were sending the CHANNEL_CONVERTED websockets event, which is intended to notify of a public channel being converted into a private one, so the interface was showing the channel as private until the client was refreshed. Now a full channel update event is sent when the channel is shared or unshared, so the interface gets the new information correctly. * Fix message type on command tests
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
cae456de2d
Коммит
d2c69fbf95
@@ -26,7 +26,7 @@ func setupForSharedChannels(tb testing.TB) *TestHelper {
|
||||
}
|
||||
|
||||
func TestShareProviderDoCommand(t *testing.T) {
|
||||
t.Run("share command sends a websocket channel converted event", func(t *testing.T) {
|
||||
t.Run("share command sends a websocket channel updated event", func(t *testing.T) {
|
||||
th := setupForSharedChannels(t).initBasic()
|
||||
defer th.tearDown()
|
||||
|
||||
@@ -52,14 +52,14 @@ func TestShareProviderDoCommand(t *testing.T) {
|
||||
response := commandProvider.DoCommand(th.App, th.Context, args, "")
|
||||
require.Equal(t, "##### "+args.T("api.command_share.channel_shared"), response.Text)
|
||||
|
||||
channelConvertedMessages := testCluster.SelectMessages(func(msg *model.ClusterMessage) bool {
|
||||
channelUpdatedMessages := testCluster.SelectMessages(func(msg *model.ClusterMessage) bool {
|
||||
event, err := model.WebSocketEventFromJSON(bytes.NewReader(msg.Data))
|
||||
return err == nil && event.EventType() == model.WebsocketEventChannelConverted
|
||||
return err == nil && event.EventType() == model.WebsocketEventChannelUpdated
|
||||
})
|
||||
assert.Len(t, channelConvertedMessages, 1) // one msg for share creation
|
||||
assert.Len(t, channelUpdatedMessages, 1) // one msg for share creation
|
||||
})
|
||||
|
||||
t.Run("unshare command sends a websocket channel converted event", func(t *testing.T) {
|
||||
t.Run("unshare command sends a websocket channel updated event", func(t *testing.T) {
|
||||
th := setupForSharedChannels(t).initBasic()
|
||||
defer th.tearDown()
|
||||
|
||||
@@ -84,11 +84,11 @@ func TestShareProviderDoCommand(t *testing.T) {
|
||||
response := commandProvider.DoCommand(th.App, th.Context, args, "")
|
||||
require.Equal(t, "##### "+args.T("api.command_share.shared_channel_unavailable"), response.Text)
|
||||
|
||||
channelConvertedMessages := testCluster.SelectMessages(func(msg *model.ClusterMessage) bool {
|
||||
channelUpdatedMessages := testCluster.SelectMessages(func(msg *model.ClusterMessage) bool {
|
||||
event, err := model.WebSocketEventFromJSON(bytes.NewReader(msg.Data))
|
||||
return err == nil && event.EventType() == model.WebsocketEventChannelConverted
|
||||
return err == nil && event.EventType() == model.WebsocketEventChannelUpdated
|
||||
})
|
||||
require.Len(t, channelConvertedMessages, 2) // one msg for share creation, one for unshare.
|
||||
require.Len(t, channelUpdatedMessages, 2) // one msg for share creation, one for unshare.
|
||||
})
|
||||
|
||||
t.Run("invite remote to channel shared with us", func(t *testing.T) {
|
||||
|
||||
Ссылка в новой задаче
Block a user