diff options
author | Joram Wilander <jwawilander@gmail.com> | 2016-06-06 14:29:10 -0400 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2016-06-06 14:29:10 -0400 |
commit | c0d1b8fbb9a141b942d73ad4869e612cdf01bbcd (patch) | |
tree | 2c1fe6dfa35bc4d9e913c3eb9aaf74e3b3a1fac6 /webapp/stores/notification_store.jsx | |
parent | eabd67e4cbc845a2f591fdcf525696c0c2505d0b (diff) | |
download | chat-c0d1b8fbb9a141b942d73ad4869e612cdf01bbcd.tar.gz chat-c0d1b8fbb9a141b942d73ad4869e612cdf01bbcd.tar.bz2 chat-c0d1b8fbb9a141b942d73ad4869e612cdf01bbcd.zip |
System messages trigger notifications when user is mentioned (#3235)
Diffstat (limited to 'webapp/stores/notification_store.jsx')
-rw-r--r-- | webapp/stores/notification_store.jsx | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/webapp/stores/notification_store.jsx b/webapp/stores/notification_store.jsx index 5935b876b..78f8e56c8 100644 --- a/webapp/stores/notification_store.jsx +++ b/webapp/stores/notification_store.jsx @@ -27,7 +27,11 @@ class NotificationStoreClass extends EventEmitter { handleRecievedPost(post, msgProps) { // Send desktop notification - if ((UserStore.getCurrentId() !== post.user_id || post.props.from_webhook === 'true') && !PostUtils.isSystemMessage(post)) { + if ((UserStore.getCurrentId() !== post.user_id || post.props.from_webhook === 'true')) { + if (PostUtils.isSystemMessage(post) && post.type !== 'system_join_leave') { + return; + } + let mentions = []; if (msgProps.mentions) { mentions = JSON.parse(msgProps.mentions); @@ -52,6 +56,8 @@ class NotificationStoreClass extends EventEmitter { let username = Utils.localizeMessage('channel_loader.someone', 'Someone'); if (post.props.override_username && global.window.mm_config.EnablePostUsernameOverride === 'true') { username = post.props.override_username; + } else if (msgProps.sender_name) { + username = msgProps.sender_name; } else if (UserStore.hasProfile(post.user_id)) { username = UserStore.getProfile(post.user_id).username; } @@ -59,6 +65,8 @@ class NotificationStoreClass extends EventEmitter { let title = Utils.localizeMessage('channel_loader.posted', 'Posted'); if (channel) { title = channel.display_name; + } else if (msgProps.channel_display_name) { + title = msgProps.channel_display_name; } let notifyText = post.message.replace(/\n+/g, ' '); |