From 90adb0524bd6096596fb7f1adec159b8ce3d307f Mon Sep 17 00:00:00 2001 From: Saturnino Abril Date: Fri, 8 Jun 2018 03:52:40 +0800 Subject: [PATCH] remove converted channel (into private) from "MoreChannels" screen of joinable channels (#1740) --- app/screens/more_channels/more_channels.js | 31 ++++++++++++++++------ package-lock.json | 4 +-- package.json | 2 +- 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/app/screens/more_channels/more_channels.js b/app/screens/more_channels/more_channels.js index 245e2ee92..29237ce8a 100644 --- a/app/screens/more_channels/more_channels.js +++ b/app/screens/more_channels/more_channels.js @@ -100,15 +100,30 @@ export default class MoreChannels extends PureComponent { setNavigatorStyles(this.props.navigator, nextProps.theme); } + const {page, searching, term} = this.state; + + let channels; + if (nextProps.channels !== this.props.channels) { + channels = nextProps.channels.slice(0, (page + 1) * General.CHANNELS_CHUNK_SIZE); + if (term) { + channels = this.filterChannels(nextProps.channels, term); + } + } + const {requestStatus} = this.props; - if (this.state.searching && - nextProps.requestStatus.status === RequestStatus.SUCCESS) { - const channels = this.filterChannels(nextProps.channels, this.state.term); - this.setState({channels, showNoResults: true}); - } else if (requestStatus.status === RequestStatus.STARTED && - nextProps.requestStatus.status === RequestStatus.SUCCESS) { - const {page} = this.state; - const channels = nextProps.channels.slice(0, (page + 1) * General.CHANNELS_CHUNK_SIZE); + if ( + searching && + nextProps.requestStatus.status === RequestStatus.SUCCESS + ) { + channels = this.filterChannels(nextProps.channels, term); + } else if ( + requestStatus.status === RequestStatus.STARTED && + nextProps.requestStatus.status === RequestStatus.SUCCESS + ) { + channels = nextProps.channels.slice(0, (page + 1) * General.CHANNELS_CHUNK_SIZE); + } + + if (channels) { this.setState({channels, showNoResults: true}); } diff --git a/package-lock.json b/package-lock.json index 52d2a995c..4e0522550 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9878,8 +9878,8 @@ } }, "mattermost-redux": { - "version": "github:mattermost/mattermost-redux#8870c690f2e29d301a65fc2f0cba77070f355fa3", - "from": "github:mattermost/mattermost-redux#8870c690f2e29d301a65fc2f0cba77070f355fa3", + "version": "github:mattermost/mattermost-redux#2ef52763c82ca1ad338e5a4dc3dc557a0ecfd528", + "from": "github:mattermost/mattermost-redux#2ef52763c82ca1ad338e5a4dc3dc557a0ecfd528", "requires": { "deep-equal": "1.0.1", "eslint-plugin-header": "1.2.0", diff --git a/package.json b/package.json index 2e5c0a9c3..478977ef6 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "intl": "1.2.5", "jail-monkey": "1.0.0", "jsc-android": "216113.0.3", - "mattermost-redux": "github:mattermost/mattermost-redux#8870c690f2e29d301a65fc2f0cba77070f355fa3", + "mattermost-redux": "github:mattermost/mattermost-redux#2ef52763c82ca1ad338e5a4dc3dc557a0ecfd528", "mime-db": "1.33.0", "prop-types": "15.6.1", "react": "16.3.2",