From 511be7714b1939892f687bbdb46f0598916adf23 Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Thu, 5 May 2016 15:34:48 -0400 Subject: Fixed PostsViewContainer to provide an initial currentLastViewed value (#2894) --- webapp/components/posts_view_container.jsx | 12 ++++++++++-- 1 file 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() }); } -- cgit v1.2.3-1-g7c22