summaryrefslogtreecommitdiffstats
path: root/api/post.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2015-07-14 10:51:20 -0400
committerJoram Wilander <jwawilander@gmail.com>2015-07-14 10:51:20 -0400
commit2e4b61ef3847a63ed14b02a5466add33de8c8cf9 (patch)
treecb712369087ab05c3adc41a6081b16a5e4e59eb3 /api/post.go
parent1ba12b0ccfe75c5beaeb10b5e64d334f005a735a (diff)
parentf406beca8b501dad508d1ffb900bf994c4192086 (diff)
downloadchat-2e4b61ef3847a63ed14b02a5466add33de8c8cf9.tar.gz
chat-2e4b61ef3847a63ed14b02a5466add33de8c8cf9.tar.bz2
chat-2e4b61ef3847a63ed14b02a5466add33de8c8cf9.zip
Merge pull request #167 from rgarmsen2295/mm-629
MM-629 Empty messages with files attached now include text in the desktop notification describing the contents
Diffstat (limited to 'api/post.go')
-rw-r--r--api/post.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/api/post.go b/api/post.go
index 650f47062..02f997166 100644
--- a/api/post.go
+++ b/api/post.go
@@ -14,6 +14,7 @@ import (
"strconv"
"strings"
"time"
+ "path/filepath"
)
func InitPost(r *mux.Router) {
@@ -437,6 +438,19 @@ func fireAndForgetNotifications(post *model.Post, teamId, teamUrl string) {
message := model.NewMessage(teamId, post.ChannelId, post.UserId, model.ACTION_POSTED)
message.Add("post", post.ToJson())
+
+ 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(mentionedUsers) != 0 {
message.Add("mentions", model.ArrayToJson(mentionedUsers))
}