From 803b58c2d41f74b852f6247472d415e1d7103108 Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Thu, 31 Mar 2016 10:33:00 -0400 Subject: Fixed PostsView not unregistering it's PreferenceStore listener when unmounting --- webapp/components/posts_view.jsx | 1 + 1 file changed, 1 insertion(+) (limited to 'webapp') diff --git a/webapp/components/posts_view.jsx b/webapp/components/posts_view.jsx index 647c7f086..adeef5abc 100644 --- a/webapp/components/posts_view.jsx +++ b/webapp/components/posts_view.jsx @@ -385,6 +385,7 @@ export default class PostsView extends React.Component { componentWillUnmount() { window.removeEventListener('resize', this.handleResize); this.scrollStopAction.cancel(); + PreferenceStore.removeChangeListener(this.updateState); } componentDidUpdate() { if (this.props.postList != null) { -- cgit v1.2.3-1-g7c22 From 307c16df5f134f687a669f0efe0bf9bcb1c27437 Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Thu, 31 Mar 2016 11:10:57 -0400 Subject: Fixed errors when joining a channel that doesn't exist yet --- webapp/components/popover_list_members.jsx | 6 +++++- webapp/stores/post_store.jsx | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'webapp') diff --git a/webapp/components/popover_list_members.jsx b/webapp/components/popover_list_members.jsx index cd583e4c3..f21b8ee1c 100644 --- a/webapp/components/popover_list_members.jsx +++ b/webapp/components/popover_list_members.jsx @@ -57,7 +57,11 @@ export default class PopoverListMembers extends React.Component { const members = this.props.members; const teamMembers = UserStore.getProfilesUsernameMap(); const currentUserId = UserStore.getCurrentId(); - const ch = ChannelStore.getCurrent(); + const ch = ChannelStore.get(this.props.channelId); + + if (!ch) { + return null; + } if (members && teamMembers) { members.sort((a, b) => { diff --git a/webapp/stores/post_store.jsx b/webapp/stores/post_store.jsx index 36393f5cd..f328ca306 100644 --- a/webapp/stores/post_store.jsx +++ b/webapp/stores/post_store.jsx @@ -531,8 +531,8 @@ PostStore.dispatchToken = AppDispatcher.register((payload) => { switch (action.type) { case ActionTypes.RECEIVED_POSTS: { const id = PostStore.currentFocusedPostId == null ? action.id : PostStore.currentFocusedPostId; - PostStore.checkBounds(id, action.numRequested, makePostListNonNull(action.post_list), action.before); PostStore.storePosts(id, makePostListNonNull(action.post_list)); + PostStore.checkBounds(id, action.numRequested, makePostListNonNull(action.post_list), action.before); PostStore.emitChange(); break; } -- cgit v1.2.3-1-g7c22 From 098873e667126ad2e52bc6b61a1ad4e428c56ace Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Thu, 31 Mar 2016 12:18:51 -0400 Subject: Changed ChannelHeader to pass channel to PopoverListMembers directly --- webapp/components/channel_header.jsx | 2 +- webapp/components/popover_list_members.jsx | 13 +++---------- 2 files changed, 4 insertions(+), 11 deletions(-) (limited to 'webapp') diff --git a/webapp/components/channel_header.jsx b/webapp/components/channel_header.jsx index 6bb466c3e..482aabc01 100644 --- a/webapp/components/channel_header.jsx +++ b/webapp/components/channel_header.jsx @@ -216,9 +216,9 @@ export default class ChannelHeader extends React.Component { if (!isDirect) { popoverListMembers = ( ); } diff --git a/webapp/components/popover_list_members.jsx b/webapp/components/popover_list_members.jsx index f21b8ee1c..226a1889c 100644 --- a/webapp/components/popover_list_members.jsx +++ b/webapp/components/popover_list_members.jsx @@ -9,8 +9,6 @@ import * as Utils from 'utils/utils.jsx'; import * as GlobalActions from 'action_creators/global_actions.jsx'; import Constants from 'utils/constants.jsx'; -import ChannelStore from 'stores/channel_store.jsx'; - import {FormattedMessage} from 'react-intl'; import React from 'react'; @@ -57,11 +55,6 @@ export default class PopoverListMembers extends React.Component { const members = this.props.members; const teamMembers = UserStore.getProfilesUsernameMap(); const currentUserId = UserStore.getCurrentId(); - const ch = ChannelStore.get(this.props.channelId); - - if (!ch) { - return null; - } if (members && teamMembers) { members.sort((a, b) => { @@ -73,7 +66,7 @@ export default class PopoverListMembers extends React.Component { members.forEach((m, i) => { let button = ''; - if (currentUserId !== m.id && ch.type !== 'D') { + if (currentUserId !== m.id && this.props.channel.type !== 'D') { button = (