summaryrefslogtreecommitdiffstats
path: root/api/post.go
diff options
context:
space:
mode:
authorenahum <nahumhbl@gmail.com>2016-09-27 11:19:50 -0300
committerChristopher Speller <crspeller@gmail.com>2016-09-27 10:19:50 -0400
commit60347559c7fb857bd5afcd93e65b6e220625da79 (patch)
treedd60ee950e12a9c64f82a1d5239d9d3327aa7ae0 /api/post.go
parentbfca752940a13c874788b0c885d36b2b263bd4fb (diff)
downloadchat-60347559c7fb857bd5afcd93e65b6e220625da79.tar.gz
chat-60347559c7fb857bd5afcd93e65b6e220625da79.tar.bz2
chat-60347559c7fb857bd5afcd93e65b6e220625da79.zip
PLT-3734 Cleaning up shouldSendEvent function (#4024)
* PLT-3734 Cleaning up shouldSendEvent function * Fix LHS unread highlight and jewel mentions
Diffstat (limited to 'api/post.go')
-rw-r--r--api/post.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/api/post.go b/api/post.go
index 0b43aef0d..1286a23d9 100644
--- a/api/post.go
+++ b/api/post.go
@@ -286,11 +286,11 @@ func handlePostEvents(c *Context, post *model.Post, triggerWebhooks bool) {
}
if channel.Type == model.CHANNEL_DIRECT {
- go makeDirectChannelVisible(c.TeamId, post.ChannelId)
+ go makeDirectChannelVisible(post.ChannelId)
}
}
-func makeDirectChannelVisible(teamId string, channelId string) {
+func makeDirectChannelVisible(channelId string) {
var members []model.ChannelMember
if result := <-Srv.Store.Channel().GetMembers(channelId); result.Err != nil {
l4g.Error(utils.T("api.post.make_direct_channel_visible.get_members.error"), channelId, result.Err.Message)
@@ -320,7 +320,7 @@ func makeDirectChannelVisible(teamId string, channelId string) {
if saveResult := <-Srv.Store.Preference().Save(&model.Preferences{*preference}); saveResult.Err != nil {
l4g.Error(utils.T("api.post.make_direct_channel_visible.save_pref.error"), member.UserId, otherUserId, saveResult.Err.Message)
} else {
- message := model.NewWebSocketEvent(teamId, channelId, member.UserId, model.WEBSOCKET_EVENT_PREFERENCE_CHANGED)
+ message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_PREFERENCE_CHANGED, "", "", member.UserId, nil)
message.Add("preference", preference.ToJson())
go Publish(message)
@@ -335,7 +335,7 @@ func makeDirectChannelVisible(teamId string, channelId string) {
if updateResult := <-Srv.Store.Preference().Save(&model.Preferences{preference}); updateResult.Err != nil {
l4g.Error(utils.T("api.post.make_direct_channel_visible.update_pref.error"), member.UserId, otherUserId, updateResult.Err.Message)
} else {
- message := model.NewWebSocketEvent(teamId, channelId, member.UserId, model.WEBSOCKET_EVENT_PREFERENCE_CHANGED)
+ message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_PREFERENCE_CHANGED, "", "", member.UserId, nil)
message.Add("preference", preference.ToJson())
go Publish(message)
@@ -778,7 +778,7 @@ func sendNotifications(c *Context, post *model.Post, team *model.Team, channel *
}
}
- message := model.NewWebSocketEvent(c.TeamId, post.ChannelId, post.UserId, model.WEBSOCKET_EVENT_POSTED)
+ message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_POSTED, "", post.ChannelId, "", nil)
message.Add("post", post.ToJson())
message.Add("channel_type", channel.Type)
message.Add("channel_display_name", channel.DisplayName)
@@ -1103,7 +1103,7 @@ func SendEphemeralPost(teamId, userId string, post *model.Post) {
post.Filenames = []string{}
}
- message := model.NewWebSocketEvent(teamId, post.ChannelId, userId, model.WEBSOCKET_EVENT_EPHEMERAL_MESSAGE)
+ message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_EPHEMERAL_MESSAGE, "", post.ChannelId, userId, nil)
message.Add("post", post.ToJson())
go Publish(message)
@@ -1164,7 +1164,7 @@ func updatePost(c *Context, w http.ResponseWriter, r *http.Request) {
} else {
rpost := result.Data.(*model.Post)
- message := model.NewWebSocketEvent(c.TeamId, rpost.ChannelId, c.Session.UserId, model.WEBSOCKET_EVENT_POST_EDITED)
+ message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_POST_EDITED, "", rpost.ChannelId, "", nil)
message.Add("post", rpost.ToJson())
go Publish(message)
@@ -1445,7 +1445,7 @@ func deletePost(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
- message := model.NewWebSocketEvent(c.TeamId, post.ChannelId, c.Session.UserId, model.WEBSOCKET_EVENT_POST_DELETED)
+ message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_POST_DELETED, "", post.ChannelId, "", nil)
message.Add("post", post.ToJson())
go Publish(message)