Commit 1e84e931 authored by Carlos Tadeu Panato Junior's avatar Carlos Tadeu Panato Junior Committed by Christopher Speller

when a channel is update propagate the channel to everybody (#6677)

parent a9ef8b52
......@@ -281,6 +281,11 @@ func UpdateChannel(channel *model.Channel) (*model.Channel, *model.AppError) {
return nil, result.Err
} else {
InvalidateCacheForChannel(channel)
messageWs := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_CHANNEL_UPDATED, "", channel.Id, "", nil)
messageWs.Add("channel", channel.ToJson())
Publish(messageWs)
return channel, nil
}
}
......
......@@ -15,6 +15,7 @@ const (
WEBSOCKET_EVENT_POST_DELETED = "post_deleted"
WEBSOCKET_EVENT_CHANNEL_DELETED = "channel_deleted"
WEBSOCKET_EVENT_CHANNEL_CREATED = "channel_created"
WEBSOCKET_EVENT_CHANNEL_UPDATED = "channel_updated"
WEBSOCKET_EVENT_DIRECT_ADDED = "direct_added"
WEBSOCKET_EVENT_GROUP_ADDED = "group_added"
WEBSOCKET_EVENT_NEW_USER = "new_user"
......
......@@ -186,6 +186,10 @@ function handleEvent(msg) {
handleChannelDeletedEvent(msg);
break;
case SocketEvents.CHANNEL_UPDATED:
handleChannelUpdatedEvent(msg);
break;
case SocketEvents.DIRECT_ADDED:
handleDirectAddedEvent(msg);
break;
......@@ -358,6 +362,11 @@ function handleUserRemovedEvent(msg) {
}
}
function handleChannelUpdatedEvent(msg) {
const channel = JSON.parse(msg.data.channel);
dispatch({type: ChannelTypes.RECEIVED_CHANNEL, data: channel});
}
function handleUserUpdatedEvent(msg) {
const user = msg.data.user;
if (UserStore.getCurrentId() !== user.id) {
......
......@@ -222,6 +222,7 @@ export const SocketEvents = {
POST_DELETED: 'post_deleted',
CHANNEL_CREATED: 'channel_created',
CHANNEL_DELETED: 'channel_deleted',
CHANNEL_UPDATED: 'channel_updated',
CHANNEL_VIEWED: 'channel_viewed',
DIRECT_ADDED: 'direct_added',
NEW_USER: 'new_user',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment