UNPKG

mattermost-redux

Version:

Common code (API client, Redux stores, logic, utility functions) for building a Mattermost client

25 lines (24 loc) 1.33 kB
"use strict"; // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. Object.defineProperty(exports, "__esModule", { value: true }); exports.makeGetUsersTypingByChannelAndPost = makeGetUsersTypingByChannelAndPost; const create_selector_1 = require("mattermost-redux/selectors/create_selector"); const common_1 = require("mattermost-redux/selectors/entities/common"); const preferences_1 = require("mattermost-redux/selectors/entities/preferences"); const user_utils_1 = require("mattermost-redux/utils/user_utils"); const getUsersTypingImpl = (profiles, teammateNameDisplay, channelId, parentPostId, typing) => { const id = channelId + parentPostId; if (typing[id]) { const users = Object.keys(typing[id]); if (users.length) { return users.map((userId) => { return (0, user_utils_1.displayUsername)(profiles[userId], teammateNameDisplay); }); } } return []; }; function makeGetUsersTypingByChannelAndPost() { return (0, create_selector_1.createSelector)('makeGetUsersTypingByChannelAndPost', common_1.getUsers, preferences_1.getTeammateNameDisplaySetting, (state, options) => options.channelId, (state, options) => options.postId, (state) => state.entities.typing, getUsersTypingImpl); }