summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornickago <ngonella@calpoly.edu>2015-07-09 12:05:04 -0700
committernickago <ngonella@calpoly.edu>2015-07-09 12:05:04 -0700
commit44000b58d911af980a604ca977898760b4a35861 (patch)
treeec73ed225caf51c288e45fddf8c4439d6808ae31
parentb6fb6ea3be059d3c54027267760ccca0f95535ee (diff)
downloadchat-44000b58d911af980a604ca977898760b4a35861.tar.gz
chat-44000b58d911af980a604ca977898760b4a35861.tar.bz2
chat-44000b58d911af980a604ca977898760b4a35861.zip
Server now notifies users they have been added to a new channel
-rw-r--r--api/channel.go4
-rw-r--r--model/message.go1
-rw-r--r--web/react/components/sidebar.jsx3
3 files changed, 8 insertions, 0 deletions
diff --git a/api/channel.go b/api/channel.go
index 8264b3e74..88db27def 100644
--- a/api/channel.go
+++ b/api/channel.go
@@ -655,6 +655,10 @@ func addChannelMember(c *Context, w http.ResponseWriter, r *http.Request) {
c.LogAudit("name=" + channel.Name + " user_id=" + userId)
+ message := model.NewMessage(c.Session.TeamId, "", userId, model.ACTION_USER_ADDED)
+
+ store.PublishAndForget(message)
+
<-Srv.Store.Channel().UpdateLastViewedAt(id, oUser.Id)
w.Write([]byte(cm.ToJson()))
}
diff --git a/model/message.go b/model/message.go
index 47f598af8..b22f470d7 100644
--- a/model/message.go
+++ b/model/message.go
@@ -15,6 +15,7 @@ const (
ACTION_POST_DELETED = "post_deleted"
ACTION_VIEWED = "viewed"
ACTION_NEW_USER = "new_user"
+ ACTION_USER_ADDED = "user_added"
)
type Message struct {
diff --git a/web/react/components/sidebar.jsx b/web/react/components/sidebar.jsx
index 0e4d38fe0..8b1a25dc9 100644
--- a/web/react/components/sidebar.jsx
+++ b/web/react/components/sidebar.jsx
@@ -263,6 +263,9 @@ var SidebarLoggedIn = React.createClass({
if (ChannelStore.getCurrentId() != msg.channel_id) {
AsyncClient.getChannels(true);
}
+ } else if (msg.action == "user_added") {
+ if (UserStore.getCurrentId() === msg.user_id)
+ AsyncClient.getChannels(true);
}
},
updateTitle: function() {