summaryrefslogtreecommitdiffstats
path: root/api/post.go
diff options
context:
space:
mode:
authorenahum <nahumhbl@gmail.com>2016-12-06 12:57:38 -0300
committerChristopher Speller <crspeller@gmail.com>2016-12-06 10:57:38 -0500
commite57cba15ea13bdd2eb7a23ba7c7853c6d9c3ef64 (patch)
tree5f2c431ce075207c450a0cf9f8abaff8f1f6d24f /api/post.go
parent08c2d289420746992b99bfe992144ef9b06b025a (diff)
downloadchat-e57cba15ea13bdd2eb7a23ba7c7853c6d9c3ef64.tar.gz
chat-e57cba15ea13bdd2eb7a23ba7c7853c6d9c3ef64.tar.bz2
chat-e57cba15ea13bdd2eb7a23ba7c7853c6d9c3ef64.zip
PLT-4762 Prevent turn off of (at)mentions (server) (#4714)
Diffstat (limited to 'api/post.go')
-rw-r--r--api/post.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/api/post.go b/api/post.go
index ef9c0991d..2dc574e9b 100644
--- a/api/post.go
+++ b/api/post.go
@@ -459,6 +459,9 @@ func getMentionKeywordsInChannel(profiles map[string]*model.User) map[string][]s
keywords := make(map[string][]string)
for id, profile := range profiles {
+ userMention := "@" + strings.ToLower(profile.Username)
+ keywords[userMention] = append(keywords[userMention], id)
+
if len(profile.NotifyProps["mention_keys"]) > 0 {
// Add all the user's mention keys
splitKeys := strings.Split(profile.NotifyProps["mention_keys"], ",")
@@ -698,7 +701,7 @@ func sendNotifications(c *Context, post *model.Post, team *model.Team, channel *
post.UserId,
&model.Post{
ChannelId: post.ChannelId,
- Message: utils.T("api.post.disabled_here", map[string]interface{}{"Users": *utils.Cfg.TeamSettings.MaxNotificationsPerChannel}),
+ Message: c.T("api.post.disabled_here", map[string]interface{}{"Users": *utils.Cfg.TeamSettings.MaxNotificationsPerChannel}),
CreateAt: post.CreateAt + 1,
},
)
@@ -711,7 +714,7 @@ func sendNotifications(c *Context, post *model.Post, team *model.Team, channel *
post.UserId,
&model.Post{
ChannelId: post.ChannelId,
- Message: utils.T("api.post.disabled_channel", map[string]interface{}{"Users": *utils.Cfg.TeamSettings.MaxNotificationsPerChannel}),
+ Message: c.T("api.post.disabled_channel", map[string]interface{}{"Users": *utils.Cfg.TeamSettings.MaxNotificationsPerChannel}),
CreateAt: post.CreateAt + 1,
},
)
@@ -724,7 +727,7 @@ func sendNotifications(c *Context, post *model.Post, team *model.Team, channel *
post.UserId,
&model.Post{
ChannelId: post.ChannelId,
- Message: utils.T("api.post.disabled_all", map[string]interface{}{"Users": *utils.Cfg.TeamSettings.MaxNotificationsPerChannel}),
+ Message: c.T("api.post.disabled_all", map[string]interface{}{"Users": *utils.Cfg.TeamSettings.MaxNotificationsPerChannel}),
CreateAt: post.CreateAt + 1,
},
)