mattermost-redux
Version:
Common code (API client, Redux stores, logic, utility functions) for building a Mattermost client
23 lines (22 loc) • 1.08 kB
JavaScript
;
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.getExternalBotAccounts = exports.ExternalBotAccountNames = void 0;
exports.getBotAccounts = getBotAccounts;
const create_selector_1 = require("mattermost-redux/selectors/create_selector");
const common_1 = require("mattermost-redux/selectors/entities/common");
exports.ExternalBotAccountNames = ['mattermost-advisor'];
function getBotAccounts(state) {
return state.entities.bots.accounts;
}
exports.getExternalBotAccounts = (0, create_selector_1.createSelector)('getExternalBotAccounts', getBotAccounts, common_1.getUsers, (botAccounts, userProfiles) => {
const nextState = {};
Object.values(botAccounts).forEach((botAccount) => {
const botUser = userProfiles[botAccount.user_id];
if (botUser && !exports.ExternalBotAccountNames.includes(botUser.username)) {
nextState[botAccount.user_id] = botAccount;
}
});
return nextState;
});