summaryrefslogtreecommitdiffstats
path: root/webapp/components/post_view
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/components/post_view')
-rw-r--r--webapp/components/post_view/post_view_cache.jsx7
-rw-r--r--webapp/components/post_view/post_view_controller.jsx9
2 files changed, 11 insertions, 5 deletions
diff --git a/webapp/components/post_view/post_view_cache.jsx b/webapp/components/post_view/post_view_cache.jsx
index c1b278c35..3b6123b09 100644
--- a/webapp/components/post_view/post_view_cache.jsx
+++ b/webapp/components/post_view/post_view_cache.jsx
@@ -17,11 +17,12 @@ export default class PostViewCache extends React.Component {
this.onChannelChange = this.onChannelChange.bind(this);
+ const currentChannelId = ChannelStore.getCurrentId();
const channel = ChannelStore.getCurrent();
this.state = {
- currentChannelId: channel.id,
- channels: [channel]
+ currentChannelId,
+ channels: channel ? [channel] : []
};
}
@@ -40,7 +41,7 @@ export default class PostViewCache extends React.Component {
const channels = Object.assign([], this.state.channels);
const currentChannel = ChannelStore.getCurrent();
- if (currentChannel == null) {
+ if (!currentChannel) {
return;
}
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) {