From 59ca3695b5247a1a36e148227d79214a6ffb776a Mon Sep 17 00:00:00 2001 From: enahum Date: Thu, 23 Feb 2017 14:43:32 -0300 Subject: [PATCH] PLT-5629 don't mark channels as unread with system messages (#291) --- service/actions/websocket.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/service/actions/websocket.js b/service/actions/websocket.js index 01951a9f0..c017220c3 100644 --- a/service/actions/websocket.js +++ b/service/actions/websocket.js @@ -31,6 +31,7 @@ import { } from 'service/constants'; import {getCurrentChannelStats} from 'service/selectors/entities/channels'; import {getUserIdFromChannelName} from 'service/utils/channel_utils'; +import {isSystemMessage} from 'service/utils/post_utils'; import EventEmitter from 'service/utils/event_emitter'; export function init(siteUrl, token, optionalWebSocket) { @@ -217,8 +218,8 @@ async function handleNewPostEvent(msg, dispatch, getState) { } ]), getState); - if (userId === users.currentId || post.channel_id === currentChannelId) { - markChannelAsRead(post.channel_id); + if (userId === users.currentId || post.channel_id === currentChannelId || isSystemMessage(post)) { + markChannelAsRead(post.channel_id)(dispatch, getState); } else { markChannelAsUnread(post.channel_id, msg.data.mentions)(dispatch, getState); }