diff options
-rw-r--r-- | webapp/components/post_view/post_view_controller.jsx | 9 | ||||
-rw-r--r-- | webapp/stores/channel_store.jsx | 6 |
2 files changed, 11 insertions, 4 deletions
diff --git a/webapp/components/post_view/post_view_controller.jsx b/webapp/components/post_view/post_view_controller.jsx index 57b488b54..53cd0b28c 100644 --- a/webapp/components/post_view/post_view_controller.jsx +++ b/webapp/components/post_view/post_view_controller.jsx @@ -202,8 +202,13 @@ export default class PostViewController extends React.Component { } } - onSetNewMessageIndicator(lastViewed, ownNewMessage) { - this.setState({lastViewed, ownNewMessage}); + onSetNewMessageIndicator() { + let lastViewed = Number.MAX_VALUE; + const member = ChannelStore.getMyMember(this.props.channel.id); + if (member != null) { + lastViewed = member.last_viewed_at; + } + this.setState({lastViewed}); } onPostListScroll(atBottom) { diff --git a/webapp/stores/channel_store.jsx b/webapp/stores/channel_store.jsx index 136423d45..d578a5d29 100644 --- a/webapp/stores/channel_store.jsx +++ b/webapp/stores/channel_store.jsx @@ -59,8 +59,8 @@ class ChannelStoreClass extends EventEmitter { this.removeListener(STATS_EVENT, callback); } - emitLastViewed(lastViewed, ownNewMessage) { - this.emit(LAST_VIEVED_EVENT, lastViewed, ownNewMessage); + emitLastViewed() { + this.emit(LAST_VIEVED_EVENT); } addLastViewedListener(callback) { @@ -373,6 +373,7 @@ ChannelStore.dispatchToken = AppDispatcher.register((payload) => { } ChannelStore.setUnreadCountsByMembers(action.members); ChannelStore.emitChange(); + ChannelStore.emitLastViewed(); break; case ActionTypes.RECEIVED_CHANNEL_MEMBER: ChannelStore.storeMyChannelMember(action.member); @@ -382,6 +383,7 @@ ChannelStore.dispatchToken = AppDispatcher.register((payload) => { } ChannelStore.setUnreadCountsByCurrentMembers(); ChannelStore.emitChange(); + ChannelStore.emitLastViewed(); break; case ActionTypes.RECEIVED_MORE_CHANNELS: ChannelStore.storeMoreChannels(action.channels); |