diff options
author | Joram Wilander <jwawilander@gmail.com> | 2016-10-28 12:41:28 -0400 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2016-10-28 09:41:28 -0700 |
commit | ef363fd88ebb731dbb0470ad7cb5f50de0f3845c (patch) | |
tree | 08cb5ded05da362e9f2b3ac90d63a7a8e91fd606 | |
parent | fcf7d185f6ce0ff0a0719779261a487755273147 (diff) | |
download | chat-ef363fd88ebb731dbb0470ad7cb5f50de0f3845c.tar.gz chat-ef363fd88ebb731dbb0470ad7cb5f50de0f3845c.tar.bz2 chat-ef363fd88ebb731dbb0470ad7cb5f50de0f3845c.zip |
Fix channel autocomplete and fix channel member query to ignore deleted channels (#4371)
-rw-r--r-- | store/sql_channel_store.go | 1 | ||||
-rw-r--r-- | webapp/components/more_channels.jsx | 57 | ||||
-rw-r--r-- | webapp/stores/channel_store.jsx | 9 |
3 files changed, 30 insertions, 37 deletions
diff --git a/store/sql_channel_store.go b/store/sql_channel_store.go index d1d48ef69..8b77ab6ff 100644 --- a/store/sql_channel_store.go +++ b/store/sql_channel_store.go @@ -1040,6 +1040,7 @@ func (s SqlChannelStore) GetMembersForUser(teamId string, userId string) StoreCh INNER JOIN Channels c ON c.Id = cm.ChannelId AND (c.TeamId = :TeamId OR c.TeamId = '') + AND c.DeleteAt = 0 WHERE cm.UserId = :UserId `, map[string]interface{}{"TeamId": teamId, "UserId": userId}) diff --git a/webapp/components/more_channels.jsx b/webapp/components/more_channels.jsx index 00e7ecf78..b72f9aedd 100644 --- a/webapp/components/more_channels.jsx +++ b/webapp/components/more_channels.jsx @@ -31,10 +31,12 @@ export default class MoreChannels extends React.Component { this.shouldComponentUpdate = PureRenderMixin.shouldComponentUpdate.bind(this); - const initState = this.getStateFromStores(); - initState.channelType = ''; - initState.showNewChannelModal = false; - this.state = initState; + this.state = { + channelType: '', + showNewChannelModal: false, + channels: null, + serverError: null + }; } componentDidMount() { @@ -140,31 +142,28 @@ export default class MoreChannels extends React.Component { } let moreChannels; - - if (this.state.channels != null) { - var channels = this.state.channels; - if (channels.loading) { - moreChannels = <LoadingScreen/>; - } else if (channels.length) { - moreChannels = ( - <FilteredChannelList - channels={channels} - handleJoin={this.handleJoin} - /> - ); - } else { - moreChannels = ( - <div className='no-channel-message'> - <p className='primary-message'> - <FormattedMessage - id='more_channels.noMore' - defaultMessage='No more channels to join' - /> - </p> - {createChannelHelpText} - </div> - ); - } + const channels = this.state.channels; + if (channels == null) { + moreChannels = <LoadingScreen/>; + } else if (channels.length) { + moreChannels = ( + <FilteredChannelList + channels={channels} + handleJoin={this.handleJoin} + /> + ); + } else { + moreChannels = ( + <div className='no-channel-message'> + <p className='primary-message'> + <FormattedMessage + id='more_channels.noMore' + defaultMessage='No more channels to join' + /> + </p> + {createChannelHelpText} + </div> + ); } return ( diff --git a/webapp/stores/channel_store.jsx b/webapp/stores/channel_store.jsx index 16a094c7b..f0258d02a 100644 --- a/webapp/stores/channel_store.jsx +++ b/webapp/stores/channel_store.jsx @@ -26,7 +26,6 @@ class ChannelStoreClass extends EventEmitter { this.channels = []; this.myChannelMembers = {}; this.moreChannels = {}; - this.moreChannels.loading = true; this.stats = {}; this.unreadCounts = {}; } @@ -300,13 +299,7 @@ class ChannelStoreClass extends EventEmitter { const ch = this.get(id); const chMember = this.getMyMember(id); - if (ch == null) { - console.log('setUnreadCountByChannel: missing channel id ' + id); //eslint-disable-line no-console - return; - } - - if (chMember == null) { - console.log('setUnreadCountByChannel: missing channel member for channel id ' + id); //eslint-disable-line no-console + if (ch == null || chMember == null) { return; } |