How to use the mattermost-redux/selectors/entities/channels.getCurrentChannel function in mattermost-redux

To help you get started, we’ve selected a few mattermost-redux examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mattermost / mattermost-webapp / components / sidebar / index.js View on Github external
function mapStateToProps(state) {
    const config = getConfig(state);
    const currentChannel = getCurrentChannel(state);
    const currentTeammate = currentChannel && currentChannel.teammate_id && getCurrentChannel(state, currentChannel.teammate_id);
    const currentTeam = getCurrentTeam(state);

    const canCreatePublicChannel = haveITeamPermission(state, {team: currentTeam.id, permission: Permissions.CREATE_PUBLIC_CHANNEL});
    const canCreatePrivateChannel = haveITeamPermission(state, {team: currentTeam.id, permission: Permissions.CREATE_PRIVATE_CHANNEL});

    const sidebarPrefs = getSidebarPreferences(state);
    const lastUnreadChannel = state.views.channel.keepChannelIdAsUnread;
    const unreadChannelIds = getSortedUnreadChannelIds(state, lastUnreadChannel);
    const orderedChannelIds = getOrderedChannelIds(
        state,
        lastUnreadChannel,
        sidebarPrefs.grouping,
        sidebarPrefs.sorting,
        sidebarPrefs.unreads_at_top === 'true',
        sidebarPrefs.favorite_at_top === 'true',
github mattermost / mattermost-mobile / app / screens / channel_members / index.js View on Github external
return (state) => {
        const currentChannel = getCurrentChannel(state);
        let currentChannelMembers = [];
        if (currentChannel.id) {
            currentChannelMembers = getChannelMembers(state, currentChannel.id, true);
        }

        const canManageUsers = canManageChannelMembers(state) && !currentChannel.group_constrained;

        return {
            canManageUsers,
            currentChannelId: currentChannel.id,
            currentChannelMembers,
            currentUserId: state.entities.users.currentUserId,
            theme: getTheme(state),
            isLandscape: isLandscape(state),
        };
    };
github mattermost / mattermost-webapp / actions / websocket_actions.jsx View on Github external
function handleUserRemovedEvent(msg) {
    const state = getState();
    const currentChannel = getCurrentChannel(state) || {};
    const currentUserId = getCurrentUserId(state);

    if (msg.broadcast.user_id === currentUserId) {
        dispatch(loadChannelsForCurrentUser());

        if (msg.data.channel_id === currentChannel.id) {
            GlobalActions.emitCloseRightHandSide();

            if (msg.data.remover_id === msg.broadcast.user_id) {
                browserHistory.push(getCurrentRelativeTeamUrl(state));
            } else {
                const user = getUser(state, msg.data.remover_id) || {};

                dispatch(openModal({
                    modalId: ModalIdentifiers.REMOVED_FROM_CHANNEL,
                    dialogType: RemovedFromChannelModal,
github mattermost / mattermost-webapp / components / create_team / index.js View on Github external
function mapStateToProps(state) {
    const config = getConfig(state);
    const license = getLicense(state);
    const currentChannel = getCurrentChannel(state);
    const currentTeam = getCurrentTeam(state);

    const isLicensed = license.IsLicensed === 'true';
    const customBrand = license.CustomBrand === 'true';
    const enableCustomBrand = config.EnableCustomBrand === 'true';
    const customDescriptionText = config.CustomDescriptionText;
    const siteName = config.SiteName;

    return {
        currentChannel,
        currentTeam,
        isLicensed,
        customBrand,
        enableCustomBrand,
        customDescriptionText,
        siteName,
github Amonith / mattermost-file-list / webapp / src / components / RootContainer.jsx View on Github external
const mapStateToProps = (state) => ({
    visible: isRootModalVisible(state),
    files: getLoadedFiles(state),
    currentRequest: (getLoadedFiles(state) || empty).Request,
    currentUserId: getCurrentUserId(state),
    currentChannelName: (getCurrentChannel(state) || empty).display_name,
    error: getError(state)
});
github mattermost / mattermost-mobile / app / scenes / channel_members / channel_members_title.js View on Github external
function mapStateToProps(state) {
    return {
        canManageUsers: canManageChannelMembers(state),
        currentChannel: getCurrentChannel(state),
        theme: getTheme(state)
    };
}
github mattermost / mattermost-mobile / app / scenes / channel_members / channel_members_container.js View on Github external
function mapStateToProps(state) {
    const currentChannelMemberCount = getCurrentChannelStats(state) && getCurrentChannelStats(state).member_count;

    return {
        theme: getTheme(state),
        currentChannel: getCurrentChannel(state),
        currentChannelMembers: getProfilesInCurrentChannel(state),
        currentChannelMemberCount,
        currentUserId: state.entities.users.currentUserId,
        currentTeam: getCurrentTeam(state),
        preferences: getMyPreferences(state),
        requestStatus: state.requests.users.getProfilesInChannel.status,
        searchRequestStatus: state.requests.users.searchProfiles.status,
        removeMembersStatus: state.requests.channels.removeChannelMember.status,
        canManageUsers: canManageChannelMembers(state)
    };
}
github mattermost / mattermost-mobile / share_extension / android / extension_post / index.js View on Github external
function mapStateToProps(state) {
    const config = getConfig(state);

    let channel = getCurrentChannel(state);
    if (channel && channel.delete_at !== 0) {
        channel = getDefaultChannel(state);
    }

    return {
        channelId: channel?.id,
        channels: getAllChannels(state),
        currentUserId: getCurrentUserId(state),
        maxFileSize: getAllowedServerMaxFileSize(config),
        teamId: getCurrentTeamId(state),
    };
}
github mattermost / mattermost-webapp / components / profile_popover / index.js View on Github external
function mapStateToProps(state, ownProps) {
    const userId = ownProps.userId;
    const team = getCurrentTeam(state);
    const teamMember = getTeamMember(state, team.id, userId);

    let isTeamAdmin = false;
    if (teamMember && teamMember.scheme_admin) {
        isTeamAdmin = true;
    }

    const selectedPost = getSelectedPost(state);
    const currentChannel = getCurrentChannel(state);

    let channelId;
    if (selectedPost.exists === false) {
        channelId = currentChannel.id;
    } else {
        channelId = selectedPost.channel_id;
    }

    const channelMember = getChannelMembersInChannels(state)[channelId][userId];

    let isChannelAdmin = false;
    if (getRhsState(state) !== 'search' && channelMember != null && channelMember.scheme_admin) {
        isChannelAdmin = true;
    }

    return {