disable add reaction for read only channels (#3407)

This commit is contained in:
Mattermost Build 2019-10-11 16:47:05 +02:00 committed by Michael Kochell
parent 5d923f3c4a
commit 9eb1aa1ad0

View file

@ -11,7 +11,7 @@ import {hasNewPermissions} from 'mattermost-redux/selectors/entities/general';
import Permissions from 'mattermost-redux/constants/permissions';
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
import {getTheme} from 'mattermost-redux/selectors/entities/preferences';
import {getChannel} from 'mattermost-redux/selectors/entities/channels';
import {getChannel, isChannelReadOnlyById} from 'mattermost-redux/selectors/entities/channels';
import {addReaction} from 'app/actions/views/emoji';
@ -25,10 +25,11 @@ function makeMapStateToProps() {
const channel = getChannel(state, channelId) || {};
const teamId = channel.team_id;
const channelIsArchived = channel.delete_at !== 0;
const channelIsReadOnly = isChannelReadOnlyById(state, channelId);
let canAddReaction = true;
let canRemoveReaction = true;
if (channelIsArchived) {
if (channelIsArchived || channelIsReadOnly) {
canAddReaction = false;
canRemoveReaction = false;
} else if (hasNewPermissions(state)) {