MM-11718: Show only non-archived channels on Share (#2059)

This commit is contained in:
Jesús Espino 2018-08-30 20:37:36 +02:00 committed by Harrison Healey
parent 3be170f507
commit 1456c7cf29
4 changed files with 16 additions and 4 deletions

View file

@ -59,6 +59,10 @@ export default class ExtensionTeam extends PureComponent {
publicChannels: publicFiltered,
} = this.props;
directFiltered = directFiltered.filter((c) => c.delete_at === 0);
privateFiletered = privateFiletered.filter((c) => c.delete_at === 0);
publicFiltered = publicFiltered.filter((c) => c.delete_at === 0);
if (term) {
directFiltered = directFiltered.filter((c) => c.display_name.toLowerCase().includes(term.toLowerCase()));
privateFiletered = privateFiletered.filter((c) => c.display_name.toLowerCase().includes(term.toLowerCase()));

View file

@ -3,7 +3,7 @@
import {connect} from 'react-redux';
import {getCurrentChannelId} from 'mattermost-redux/selectors/entities/channels';
import {getCurrentChannel, getDefaultChannel} from 'mattermost-redux/selectors/entities/channels';
import {getCurrentTeamId} from 'mattermost-redux/selectors/entities/teams';
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
import {getConfig} from 'mattermost-redux/selectors/entities/general';
@ -16,9 +16,13 @@ function mapStateToProps(state) {
const config = getConfig(state);
const {credentials} = state.entities.general;
const {token, url} = credentials;
let channel = getCurrentChannel(state);
if (channel.delete_at !== 0) {
channel = getDefaultChannel(state);
}
return {
channelId: getCurrentChannelId(state),
channelId: channel.id,
currentUserId: getCurrentUserId(state),
maxFileSize: getAllowedServerMaxFileSize(config),
teamId: getCurrentTeamId(state),

View file

@ -53,7 +53,7 @@ export default class ExtensionChannels extends PureComponent {
channels.forEach((channel) => {
const include = term ? channel.display_name.toLowerCase().includes(term.toLowerCase()) : true;
if (channel.display_name && include) {
if (channel.display_name && include && channel.delete_at === 0) {
switch (channel.type) {
case General.OPEN_CHANNEL:
publicChannels.push(channel);

View file

@ -22,7 +22,7 @@ import RNFetchBlob from 'rn-fetch-blob';
import {Client4} from 'mattermost-redux/client';
import {General} from 'mattermost-redux/constants';
import {getChannel} from 'mattermost-redux/selectors/entities/channels';
import {getChannel, getDefaultChannel} from 'mattermost-redux/selectors/entities/channels';
import {getFormattedFileSize, lookupMimeType} from 'mattermost-redux/utils/file_utils';
import {isMinimumServerVersion} from 'mattermost-redux/utils/helpers';
@ -237,6 +237,10 @@ export default class ExtensionPost extends PureComponent {
channel = getChannel({entities}, channel.id);
}
if (channel.delete_at !== 0) {
channel = getDefaultChannel({entities});
}
for (let i = 0; i < items.length; i++) {
const item = items[i];
switch (item.type) {