From 55752fb359f805196e9acc1497cee658d30fa6ed Mon Sep 17 00:00:00 2001 From: enahum Date: Mon, 27 Feb 2017 18:50:30 -0300 Subject: [PATCH] Fix channel created WS event (#5552) --- app/channel.go | 1 + webapp/actions/websocket_actions.jsx | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/channel.go b/app/channel.go index 71e8cee2c9..8352b3b9d3 100644 --- a/app/channel.go +++ b/app/channel.go @@ -107,6 +107,7 @@ func CreateChannelWithUser(channel *model.Channel, userId string) (*model.Channe message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_CHANNEL_CREATED, "", "", userId, nil) message.Add("channel_id", channel.Id) + message.Add("team_id", channel.TeamId) Publish(message) return rchannel, nil diff --git a/webapp/actions/websocket_actions.jsx b/webapp/actions/websocket_actions.jsx index e6403839db..c181a5e3a7 100644 --- a/webapp/actions/websocket_actions.jsx +++ b/webapp/actions/websocket_actions.jsx @@ -286,8 +286,9 @@ function handleUserUpdatedEvent(msg) { function handleChannelCreatedEvent(msg) { const channelId = msg.data.channel_id; + const teamId = msg.data.team_id; - if (!ChannelStore.getChannelById(channelId)) { + if (TeamStore.getCurrentId() === teamId && !ChannelStore.getChannelById(channelId)) { AsyncClient.getChannel(channelId); } }