From e737ec3eb5d16a8ea371c0bd9379d8d0a937764c Mon Sep 17 00:00:00 2001 From: hmhealey Date: Mon, 13 Jul 2015 15:43:05 -0400 Subject: [PATCH] Allow Users to be notified using @all, @channel, and their first name when other notifications are disabled --- api/post.go | 8 ++++---- web/react/stores/user_store.jsx | 16 +++++++--------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/api/post.go b/api/post.go index e625912734..5b7983386c 100644 --- a/api/post.go +++ b/api/post.go @@ -298,11 +298,11 @@ func fireAndForgetNotifications(post *model.Post, teamId, teamUrl string) { for _, k := range splitKeys { keywordMap[k] = append(keywordMap[strings.ToLower(k)], profile.Id) } + } - // If turned on, add the user's case sensitive first name - if profile.NotifyProps["first_name"] == "true" { - keywordMap[profile.FirstName] = append(keywordMap[profile.FirstName], profile.Id) - } + // If turned on, add the user's case sensitive first name + if profile.NotifyProps["first_name"] == "true" { + keywordMap[profile.FirstName] = append(keywordMap[profile.FirstName], profile.Id) } // Add @all to keywords if user has them turned on diff --git a/web/react/stores/user_store.jsx b/web/react/stores/user_store.jsx index e417e72ff3..b0ea719d48 100644 --- a/web/react/stores/user_store.jsx +++ b/web/react/stores/user_store.jsx @@ -177,17 +177,15 @@ var UserStore = assign({}, EventEmitter.prototype, { }, getCurrentMentionKeys: function() { var user = this.getCurrentUser(); - if (user && user.notify_props && user.notify_props.mention_keys) { - var keys = user.notify_props.mention_keys.split(','); - if (user.first_name && user.notify_props.first_name === "true") keys.push(user.first_name); - if (user.notify_props.all === "true") keys.push('@all'); - if (user.notify_props.channel === "true") keys.push('@channel'); + var keys = []; - return keys; - } else { - return []; - } + if (user.notify_props && user.notify_props.mention_keys) keys = keys.concat(user.notify_props.mention_keys.split(',')); + if (user.first_name && user.notify_props.first_name === "true") keys.push(user.first_name); + if (user.notify_props.all === "true") keys.push('@all'); + if (user.notify_props.channel === "true") keys.push('@channel'); + + return keys; }, getLastVersion: function() { return BrowserStore.getItem("last_version", '');