Skip to content

Commit ae4e2eb

Browse files
author
Jaap
committed
add conditional checks in MessageOptions for new messageActions
1 parent bb4530b commit ae4e2eb

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/components/Message/MessageOptions.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import React, { useContext } from 'react';
33
import { useUserRole, useOpenThreadHandler } from './hooks';
44
import { ChannelContext } from '../../context';
55
import { MessageActions } from '../MessageActions';
6+
import { MESSAGE_ACTIONS } from './utils';
67
import { ThreadIcon, ReactionIcon } from './icons';
78

89
/**
@@ -28,9 +29,19 @@ const MessageOptionsComponent = (props) => {
2829
*/
2930
const { channel } = useContext(ChannelContext);
3031
const channelConfig = channel?.getConfig();
32+
const messageActions = props.getMessageActions();
33+
const shouldShowReactions =
34+
messageActions.indexOf(MESSAGE_ACTIONS.react) > -1 &&
35+
channelConfig &&
36+
channelConfig.reactions;
3137
const shouldShowReplies =
32-
displayReplies && !threadList && channelConfig && channelConfig.replies;
33-
const shouldShowReactions = channelConfig && channelConfig.reactions;
38+
messageActions.indexOf(MESSAGE_ACTIONS.reply) > -1 &&
39+
displayReplies &&
40+
!threadList &&
41+
channelConfig &&
42+
channelConfig.replies;
43+
44+
console.log(messageActions);
3445
if (
3546
!message ||
3647
message.type === 'error' ||
@@ -53,7 +64,7 @@ const MessageOptionsComponent = (props) => {
5364
<div
5465
data-testid="thread-action"
5566
onClick={propHandleOpenThread || handleOpenThread}
56-
className={`str-chat__message-${theme} str-chat__message-${theme}__actions__action--thread`}
67+
className={`str-chat__message-${theme}__actions__action str-chat__message-${theme}__actions__action--thread`}
5768
>
5869
<ThreadIcon />
5970
</div>

0 commit comments

Comments
 (0)