From 9eb1aa1ad06290d3cddfae1cff8d28e25636d511 Mon Sep 17 00:00:00 2001 From: Mattermost Build Date: Fri, 11 Oct 2019 16:47:05 +0200 Subject: [PATCH] disable add reaction for read only channels (#3407) --- app/components/reactions/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/components/reactions/index.js b/app/components/reactions/index.js index e778343b6..2ea6fe1a5 100644 --- a/app/components/reactions/index.js +++ b/app/components/reactions/index.js @@ -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)) {