diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2016-05-05 15:34:48 -0400 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2016-05-05 12:34:48 -0700 |
commit | 511be7714b1939892f687bbdb46f0598916adf23 (patch) | |
tree | 906448927944332602e7b5065081ed9bf50e21e4 /webapp/components/posts_view_container.jsx | |
parent | cf05c92effb51cc5649bc8b27babb6ed77959f0c (diff) | |
download | chat-511be7714b1939892f687bbdb46f0598916adf23.tar.gz chat-511be7714b1939892f687bbdb46f0598916adf23.tar.bz2 chat-511be7714b1939892f687bbdb46f0598916adf23.zip |
Fixed PostsViewContainer to provide an initial currentLastViewed value (#2894)
Diffstat (limited to 'webapp/components/posts_view_container.jsx')
-rw-r--r-- | webapp/components/posts_view_container.jsx | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/webapp/components/posts_view_container.jsx b/webapp/components/posts_view_container.jsx index c0a74ca84..d1d8a2093 100644 --- a/webapp/components/posts_view_container.jsx +++ b/webapp/components/posts_view_container.jsx @@ -34,18 +34,26 @@ export default class PostsViewContainer extends React.Component { scrollPost: null }; if (currentChannelId) { + let lastViewed = Date.now(); + const member = ChannelStore.getMember(currentChannelId); + if (member) { + lastViewed = member.last_viewed_at; + } + Object.assign(state, { currentChannelIndex: 0, channels: [currentChannelId], postLists: [this.getChannelPosts(currentChannelId)], - atTop: [PostStore.getVisibilityAtTop(currentChannelId)] + atTop: [PostStore.getVisibilityAtTop(currentChannelId)], + currentLastViewed: lastViewed }); } else { Object.assign(state, { currentChannelIndex: null, channels: [], postLists: [], - atTop: [] + atTop: [], + currentLastViewed: Date.now() }); } |