mattermost-redux
Version:
Common code (API client, Redux stores, logic, utility functions) for building a Mattermost client
26 lines (25 loc) • 1.07 kB
JavaScript
;
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRemoteNamesForChannel = getRemoteNamesForChannel;
exports.getRemotesForChannel = getRemotesForChannel;
exports.getRemoteClusterInfo = getRemoteClusterInfo;
exports.getRemoteDisplayName = getRemoteDisplayName;
function getRemoteNamesForChannel(state, channelId) {
const remotes = state.entities?.sharedChannels?.remotes?.[channelId];
if (remotes && remotes.length > 0) {
return remotes.map((remote) => remote.display_name);
}
return [];
}
function getRemotesForChannel(state, channelId) {
return state.entities?.sharedChannels?.remotes?.[channelId] || [];
}
function getRemoteClusterInfo(state, remoteId) {
return state.entities?.sharedChannels?.remotesByRemoteId?.[remoteId] || null;
}
function getRemoteDisplayName(state, remoteId) {
const remote = getRemoteClusterInfo(state, remoteId);
return remote?.display_name || null;
}