mattermost-mobile/app/screens/more_channels/index.js
Anurag Shivarathri 6e23fbe7a7
MM-32921 shared channels (#5241)
* Unable to open previews from search, pinned and mentions

* Updated Compass Icons

* Added Icon to LHS and Channel Info

* Added Icons to Manage/View Members list

* Added Icon to shared users in posts

* Added icon to channel header, fixed header style

* Added Icons in autocomplete

* WIP: Add shared shannels to browse

* Adding Shared Channels string to i18n

* Added remote organization to remote user profile

* Updated snapshot for channel header

* Added browsing shared channels

* Removed the exmpty line

* Added snapshot when user is remote

* Reverted compass icons and added icons only needed for shared channels

* Fixed i18n swapped

* Copied compass-icons from webapp

* Fixed showing shared channels as deleted after browsing them

* Added new compass ttf to android & fixed icon style for browse channel listing

* Fixed search for shared channels

* user profile snapshot updated with testId

* User list row snapshot updated with testID

* Moved shared user check to util function

* Fixed required props warning for ChannelIcon component

* Update app/screens/user_profile/index.js

Co-authored-by: Miguel Alatzar <migbot@users.noreply.github.com>

* Removed Request related redux

* Reverted client4

* Added rest calls

* Updated snapshot

* Reverted files

* Adding back shared channels stuff to channel icon & showing shared channels only when enabled in browse channels

* Fixed misc issues

* moved empty array outside the function to avoid re-render

* Removed renaming fields

Co-authored-by: Miguel Alatzar <migbot@users.noreply.github.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-05-24 16:07:47 +05:30

63 lines
2.5 KiB
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {bindActionCreators} from 'redux';
import {connect} from 'react-redux';
import {handleSelectChannel, setChannelDisplayName} from '@actions/views/channel';
import {General} from '@mm-redux/constants';
import {getArchivedChannels, getChannels, getSharedChannels, joinChannel, searchChannels} from '@mm-redux/actions/channels';
import {getCurrentUserId, getCurrentUserRoles} from '@mm-redux/selectors/entities/users';
import {getCurrentTeamId} from '@mm-redux/selectors/entities/teams';
import {showCreateOption} from '@mm-redux/utils/channel_utils';
import {isMinimumServerVersion} from '@mm-redux/utils/helpers';
import {isAdmin, isSystemAdmin} from '@mm-redux/utils/user_utils';
import {getTheme} from '@mm-redux/selectors/entities/preferences';
import {getConfig, getLicense} from '@mm-redux/selectors/entities/general';
import {teamArchivedChannels, joinablePublicChannels, joinableSharedChannels} from '@selectors/channel';
import MoreChannels from './more_channels';
const defaultSharedChannels = [];
function mapStateToProps(state) {
const config = getConfig(state);
const license = getLicense(state);
const sharedChannelsEnabled = config.ExperimentalSharedChannels === 'true';
const roles = getCurrentUserRoles(state);
const channels = joinablePublicChannels(state);
const sharedChannels = sharedChannelsEnabled ? joinableSharedChannels(state) : defaultSharedChannels;
const archivedChannels = teamArchivedChannels(state);
const currentTeamId = getCurrentTeamId(state);
const canShowArchivedChannels = config.ExperimentalViewArchivedChannels === 'true' &&
isMinimumServerVersion(state.entities.general.serverVersion, 5, 18);
return {
canCreateChannels: showCreateOption(state, config, license, currentTeamId, General.OPEN_CHANNEL, isAdmin(roles), isSystemAdmin(roles)),
currentUserId: getCurrentUserId(state),
currentTeamId,
channels,
sharedChannels,
sharedChannelsEnabled,
archivedChannels,
theme: getTheme(state),
canShowArchivedChannels,
};
}
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators({
getArchivedChannels,
getChannels,
getSharedChannels,
handleSelectChannel,
joinChannel,
searchChannels,
setChannelDisplayName,
}, dispatch),
};
}
export default connect(mapStateToProps, mapDispatchToProps)(MoreChannels);