MM-15486 - Archived channels appear incorrectly on mobile (#2882)
* properly separate archived channels from 'other' * make sure fetch is performed to display full list * reverted unneeded change * corrected display behaviour * code cleanup * redux commit reference updated
This commit is contained in:
parent
630a3db2a6
commit
c84b05217b
5 changed files with 27 additions and 5 deletions
|
|
@ -44,6 +44,7 @@ class FilteredList extends Component {
|
|||
teammateNameDisplay: PropTypes.string,
|
||||
onSelectChannel: PropTypes.func.isRequired,
|
||||
otherChannels: PropTypes.array,
|
||||
archivedChannels: PropTypes.array,
|
||||
profiles: PropTypes.object,
|
||||
teamProfiles: PropTypes.object,
|
||||
searchOrder: PropTypes.array.isRequired,
|
||||
|
|
@ -176,6 +177,11 @@ class FilteredList extends Component {
|
|||
id: t('mobile.channel_list.not_member'),
|
||||
defaultMessage: 'NOT A MEMBER',
|
||||
},
|
||||
archived: {
|
||||
builder: this.buildArchivedForSearch,
|
||||
id: t('mobile.channel_list.archived'),
|
||||
defaultMessage: 'ARCHIVED',
|
||||
},
|
||||
});
|
||||
|
||||
buildUnreadChannelsForSearch = (props, term) => {
|
||||
|
|
@ -294,6 +300,19 @@ class FilteredList extends Component {
|
|||
sort(sortChannelsByDisplayName.bind(null, props.intl.locale));
|
||||
}
|
||||
|
||||
buildArchivedForSearch = (props, term) => {
|
||||
const {currentChannel, archivedChannels} = props;
|
||||
|
||||
return this.filterChannels(archivedChannels.reduce((acc, channel) => {
|
||||
// when there is no search text, display an archived channel only if we are in it at the moment.
|
||||
if (term || channel.id === currentChannel.id) {
|
||||
acc.push({...channel});
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, []), term);
|
||||
}
|
||||
|
||||
buildOtherMembersForSearch = (props, term) => {
|
||||
const {otherChannels} = props;
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import {
|
|||
getChannelsWithUnreadSection,
|
||||
getCurrentChannel,
|
||||
getGroupChannels,
|
||||
getArchivedChannels,
|
||||
getOtherChannels,
|
||||
} from 'mattermost-redux/selectors/entities/channels';
|
||||
import {getConfig} from 'mattermost-redux/selectors/entities/general';
|
||||
|
|
@ -24,7 +25,7 @@ import Config from 'assets/config';
|
|||
|
||||
import FilteredList from './filtered_list';
|
||||
|
||||
const DEFAULT_SEARCH_ORDER = ['unreads', 'dms', 'channels', 'members', 'nonmembers'];
|
||||
const DEFAULT_SEARCH_ORDER = ['unreads', 'dms', 'channels', 'members', 'nonmembers', 'archived'];
|
||||
|
||||
const pastDirectMessages = createSelector(
|
||||
getDirectShowPreferences,
|
||||
|
|
@ -112,7 +113,8 @@ function mapStateToProps(state) {
|
|||
currentChannel: getCurrentChannel(state),
|
||||
currentTeam: getCurrentTeam(state),
|
||||
currentUserId,
|
||||
otherChannels: getOtherChannels(state),
|
||||
otherChannels: getOtherChannels(state, false),
|
||||
archivedChannels: getArchivedChannels(state),
|
||||
groupChannelMemberDetails: getGroupChannelMemberDetails(state),
|
||||
profiles,
|
||||
teamProfiles,
|
||||
|
|
|
|||
|
|
@ -165,6 +165,7 @@
|
|||
"mobile.channel_info.publicChannel": "Public Channel",
|
||||
"mobile.channel_list.alertNo": "No",
|
||||
"mobile.channel_list.alertYes": "Yes",
|
||||
"mobile.channel_list.archived": "ARCHIVED",
|
||||
"mobile.channel_list.channels": "CHANNELS",
|
||||
"mobile.channel_list.closeDM": "Close Direct Message",
|
||||
"mobile.channel_list.closeGM": "Close Group Message",
|
||||
|
|
|
|||
4
package-lock.json
generated
4
package-lock.json
generated
|
|
@ -13134,8 +13134,8 @@
|
|||
"integrity": "sha512-rUxjysqif/BZQH2yhd5Aaq7vXMSx9NdEsQcyA07uEzIvxgI7zIr33gGsh+RU0/XjmQpCW7RsVof1vlkvQVCK5A=="
|
||||
},
|
||||
"mattermost-redux": {
|
||||
"version": "github:mattermost/mattermost-redux#80407bc07f477eaeb93be4045a686b6bf977697f",
|
||||
"from": "github:mattermost/mattermost-redux#80407bc07f477eaeb93be4045a686b6bf977697f",
|
||||
"version": "github:mattermost/mattermost-redux#6df64ba38d8b68c63c568b1259f6a5b660d1879f",
|
||||
"from": "github:mattermost/mattermost-redux#6df64ba38d8b68c63c568b1259f6a5b660d1879f",
|
||||
"requires": {
|
||||
"deep-equal": "1.0.1",
|
||||
"eslint-plugin-header": "3.0.0",
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
"intl": "1.2.5",
|
||||
"jail-monkey": "2.2.0",
|
||||
"jsc-android": "241213.1.0",
|
||||
"mattermost-redux": "github:mattermost/mattermost-redux#80407bc07f477eaeb93be4045a686b6bf977697f",
|
||||
"mattermost-redux": "github:mattermost/mattermost-redux#6df64ba38d8b68c63c568b1259f6a5b660d1879f",
|
||||
"mime-db": "1.40.0",
|
||||
"moment-timezone": "0.5.25",
|
||||
"prop-types": "15.7.2",
|
||||
|
|
|
|||
Loading…
Reference in a new issue