summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2016-05-31 10:45:45 -0400
committerChristopher Speller <crspeller@gmail.com>2016-05-31 10:45:45 -0400
commit8f984771ae99e903f834236e24a1048d163a0ae6 (patch)
treecc8485153c22ac14e3ad495063f39ee5570a0e57 /api
parentca5e8d38e94388b53ed9f847ea6fedb4ffec3412 (diff)
downloadchat-8f984771ae99e903f834236e24a1048d163a0ae6.tar.gz
chat-8f984771ae99e903f834236e24a1048d163a0ae6.tar.bz2
chat-8f984771ae99e903f834236e24a1048d163a0ae6.zip
Send websocket event for system message posts (#3162)
Diffstat (limited to 'api')
-rw-r--r--api/post.go32
1 files changed, 17 insertions, 15 deletions
diff --git a/api/post.go b/api/post.go
index b20e7b47c..d5d3564f2 100644
--- a/api/post.go
+++ b/api/post.go
@@ -467,7 +467,24 @@ func handleWebhookEvents(c *Context, post *model.Post, team *model.Team, channel
}
func sendNotifications(c *Context, post *model.Post, team *model.Team, channel *model.Channel, profileMap map[string]*model.User, members []model.ChannelMember) {
+ message := model.NewMessage(c.TeamId, post.ChannelId, post.UserId, model.ACTION_POSTED)
+ message.Add("post", post.ToJson())
+ message.Add("channel_type", channel.Type)
+
+ if len(post.Filenames) != 0 {
+ message.Add("otherFile", "true")
+
+ for _, filename := range post.Filenames {
+ ext := filepath.Ext(filename)
+ if model.IsFileExtImage(ext) {
+ message.Add("image", "true")
+ break
+ }
+ }
+ }
+
if post.IsSystemMessage() {
+ go Publish(message)
return
}
@@ -623,23 +640,8 @@ func sendNotifications(c *Context, post *model.Post, team *model.Team, channel *
}
}
- message := model.NewMessage(c.TeamId, post.ChannelId, post.UserId, model.ACTION_POSTED)
- message.Add("post", post.ToJson())
- message.Add("channel_type", channel.Type)
message.Add("sender_name", senderName)
- if len(post.Filenames) != 0 {
- message.Add("otherFile", "true")
-
- for _, filename := range post.Filenames {
- ext := filepath.Ext(filename)
- if model.IsFileExtImage(ext) {
- message.Add("image", "true")
- break
- }
- }
- }
-
if len(mentionedUsersList) != 0 {
message.Add("mentions", model.ArrayToJson(mentionedUsersList))
}