Fixed PostsViewContainer to provide an initial currentLastViewed value (#2894)

Этот коммит содержится в:
Harrison Healey
2016-05-05 15:34:48 -04:00
коммит произвёл Corey Hulen
родитель cf05c92eff
Коммит 511be7714b

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

@@ -34,18 +34,26 @@ export default class PostsViewContainer extends React.Component {
scrollPost: null scrollPost: null
}; };
if (currentChannelId) { if (currentChannelId) {
let lastViewed = Date.now();
const member = ChannelStore.getMember(currentChannelId);
if (member) {
lastViewed = member.last_viewed_at;
}
Object.assign(state, { Object.assign(state, {
currentChannelIndex: 0, currentChannelIndex: 0,
channels: [currentChannelId], channels: [currentChannelId],
postLists: [this.getChannelPosts(currentChannelId)], postLists: [this.getChannelPosts(currentChannelId)],
atTop: [PostStore.getVisibilityAtTop(currentChannelId)] atTop: [PostStore.getVisibilityAtTop(currentChannelId)],
currentLastViewed: lastViewed
}); });
} else { } else {
Object.assign(state, { Object.assign(state, {
currentChannelIndex: null, currentChannelIndex: null,
channels: [], channels: [],
postLists: [], postLists: [],
atTop: [] atTop: [],
currentLastViewed: Date.now()
}); });
} }