Fix commenting in RHS marking channel unread (#5405)

Этот коммит содержится в:
Joram Wilander
2017-02-14 15:55:35 -05:00
коммит произвёл GitHub
родитель 86a92f8c75
Коммит b86e0daf83

Просмотреть файл

@@ -394,7 +394,7 @@ class ChannelStoreClass extends EventEmitter {
return false; return false;
} }
incrementMessages(id) { incrementMessages(id, markRead = false) {
if (!this.unreadCounts[id]) { if (!this.unreadCounts[id]) {
return; return;
} }
@@ -404,8 +404,13 @@ class ChannelStoreClass extends EventEmitter {
return; return;
} }
this.unreadCounts[id].msgs++;
this.get(id).total_msg_count++; this.get(id).total_msg_count++;
if (markRead) {
this.resetCounts(id);
} else {
this.unreadCounts[id].msgs++;
}
} }
incrementMentionsIfNeeded(id, msgProps) { incrementMentionsIfNeeded(id, msgProps) {
@@ -510,14 +515,15 @@ ChannelStore.dispatchToken = AppDispatcher.register((payload) => {
// Current team and not current channel or the window is inactive // Current team and not current channel or the window is inactive
if ((TeamStore.getCurrentId() === teamId || teamId === '') && (ChannelStore.getCurrentId() !== id || !window.isActive)) { if ((TeamStore.getCurrentId() === teamId || teamId === '') && (ChannelStore.getCurrentId() !== id || !window.isActive)) {
ChannelStore.incrementMessages(id); ChannelStore.incrementMessages(id, action.post.user_id === UserStore.getCurrentId());
ChannelStore.incrementMentionsIfNeeded(id, action.websocketMessageProps); ChannelStore.incrementMentionsIfNeeded(id, action.websocketMessageProps);
ChannelStore.emitChange(); ChannelStore.emitChange();
} }
break; break;
case ActionTypes.CREATE_POST: case ActionTypes.CREATE_POST:
ChannelStore.incrementMessages(action.post.channel_id); ChannelStore.incrementMessages(action.post.channel_id, true);
ChannelStore.emitChange();
break; break;
default: default: