[MM-19243] Disable reactions on read only channel (#3404)

This commit is contained in:
Michael Kochell 2019-10-11 08:25:47 -06:00 committed by GitHub
parent 00356ad543
commit 1b16861174
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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)) {