mattermost-redux
Version:
Common code (API client, Redux stores, logic, utility functions) for building a Mattermost client
24 lines (23 loc) • 1.04 kB
JavaScript
;
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.canAddReactions = canAddReactions;
exports.canRemoveReactions = canRemoveReactions;
const constants_1 = require("mattermost-redux/constants");
const channels_1 = require("./channels");
const roles_1 = require("./roles");
function canAddReactions(state, channelId) {
const channel = (0, channels_1.getChannel)(state, channelId);
if (!channel || channel.delete_at > 0) {
return false;
}
return (0, roles_1.haveIChannelPermission)(state, channel.team_id, channelId, constants_1.Permissions.ADD_REACTION);
}
function canRemoveReactions(state, channelId) {
const channel = (0, channels_1.getChannel)(state, channelId);
if (!channel || channel.delete_at > 0) {
return false;
}
return (0, roles_1.haveIChannelPermission)(state, channel.team_id, channelId, constants_1.Permissions.REMOVE_REACTION);
}