diff options
author | Christopher Speller <crspeller@gmail.com> | 2016-11-21 12:17:58 -0500 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2016-11-21 12:17:58 -0500 |
commit | 0ef77dff13bc74a396a412d7d416c7a7a3a9f447 (patch) | |
tree | 99bf416d3e597b6bb048b5fe2660a9d1e826c698 /webapp | |
parent | 062f758e47cda90a9ae783cbaee6bf3bec571178 (diff) | |
download | chat-0ef77dff13bc74a396a412d7d416c7a7a3a9f447.tar.gz chat-0ef77dff13bc74a396a412d7d416c7a7a3a9f447.tar.bz2 chat-0ef77dff13bc74a396a412d7d416c7a7a3a9f447.zip |
Fixing new messages indicator (#4614)
Diffstat (limited to 'webapp')
-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); |