disable add reaction for read only channels (#3407)
This commit is contained in:
parent
5d923f3c4a
commit
9eb1aa1ad0
1 changed files with 3 additions and 2 deletions
|
|
@ -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)) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue