PLT-5629 don't mark channels as unread with system messages (#291)

This commit is contained in:
enahum 2017-02-23 14:43:32 -03:00 committed by GitHub
parent 06cf8b7851
commit 59ca3695b5

View file

@ -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);
}