When removed from a channel, user is sent back to town square and that

channel is removed from their sidebar
This commit is contained in:
nickago
2015-07-13 13:18:50 -07:00
parent 85ff151b71
commit c9459feb59
3 changed files with 13 additions and 0 deletions

View File

@@ -710,6 +710,10 @@ func removeChannelMember(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
message := model.NewMessage(c.Session.TeamId, "", userId, model.ACTION_USER_REMOVED)
message.Add("channel_id",id)
PublishAndForget(message)
c.LogAudit("name=" + channel.Name + " user_id=" + userId)
result := make(map[string]string)

View File

@@ -16,6 +16,7 @@ const (
ACTION_VIEWED = "viewed"
ACTION_NEW_USER = "new_user"
ACTION_USER_ADDED = "user_added"
ACTION_USER_REMOVED = "user_removed"
)
type Message struct {

View File

@@ -197,6 +197,14 @@ module.exports = React.createClass({
if (UserStore.getCurrentId() === msg.user_id) {
AsyncClient.getChannels(true);
}
} else if(msg.action === "user_removed") {
if(msg.user_id === UserStore.getCurrentId()) {
AsyncClient.getChannels(true);
if(msg.props.channel_id === ChannelStore.getCurrentId()) {
window.location.reload();
}
}
}
},
updateTitle: function() {