From 99d79eee56a1b5a27f18fffd90545b4aef191bba Mon Sep 17 00:00:00 2001
From: Florian Orben <florian.orben@gmail.com>
Date: Fri, 4 Dec 2015 20:18:49 +0100
Subject: add helper method to add ephemeral messages; also switch 'delete
 message' to this new method

---
 web/react/stores/socket_store.jsx | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

(limited to 'web/react/stores/socket_store.jsx')

diff --git a/web/react/stores/socket_store.jsx b/web/react/stores/socket_store.jsx
index d5aed40cf..87467b02f 100644
--- a/web/react/stores/socket_store.jsx
+++ b/web/react/stores/socket_store.jsx
@@ -160,11 +160,15 @@ function handleNewPostEvent(msg) {
             AsyncClient.updateLastViewedAt();
         }
     } else if (UserStore.getCurrentId() !== msg.user_id || post.type !== Constants.POST_TYPE_JOIN_LEAVE) {
-        AsyncClient.getChannel(msg.channel_id);
+        if (msg.props.ephemeral) {
+            AsyncClient.getChannelAndAddUnreadMessages(msg.channel_id, 1);
+        } else {
+            AsyncClient.getChannel(msg.channel_id);
+        }
     }
 
     // Send desktop notification
-    if ((UserStore.getCurrentId() !== msg.user_id || post.props.from_webhook === 'true') && !Utils.isSystemMessage(post)) {
+    if ((UserStore.getCurrentId() !== msg.user_id || post.props.from_webhook === 'true') && !Utils.isSystemMessage(post) && !post.props.disable_notification) {
         const msgProps = msg.props;
 
         let mentions = [];
-- 
cgit v1.2.3-1-g7c22

