mattermost-mobile/share_extension/android/actions/index.js
Elias Nahum d3a6e166ad
MM-15758 Update dependencies including Fastlane (#4272)
* Update dependencies including Fastlane and disable Flipper on iOS

* Remove EventEmitter for previous doc-viewer

* Fix android crash when setting more channels buttons

* Downgrade fuse.js

* Upgrade deps to latest

* Update Podfile.lock

* Downgrade RNN to 6.4.0

* QA Review #2

* Upgrade fuse.js to 6.0.0
2020-05-18 11:24:47 -07:00

27 lines
942 B
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {getRedirectChannelNameForTeam, getChannelsNameMapInTeam} from '@mm-redux/selectors/entities/channels';
import {getChannelByName} from '@mm-redux/utils/channel_utils';
import {loadChannelsForTeam} from 'app/actions/views/channel';
import {ViewTypes} from 'app/constants';
export function getTeamChannels(teamId) {
return async (dispatch, getState) => {
await dispatch(loadChannelsForTeam(teamId));
const state = getState();
const channelsInTeam = getChannelsNameMapInTeam(state, teamId);
const redirectChannel = getChannelByName(channelsInTeam, getRedirectChannelNameForTeam(state, teamId));
return redirectChannel?.id;
};
}
export function extensionSelectTeamId(teamId) {
return {
type: ViewTypes.EXTENSION_SELECTED_TEAM_ID,
data: teamId,
};
}