};
function MessageReactionGroup({ roomTimeline, mEvent }) {
- const { roomId, reactionTimeline } = roomTimeline;
+ const { roomId, room, reactionTimeline } = roomTimeline;
const eventId = mEvent.getId();
const mx = initMatrix.matrixClient;
const reactions = {};
- const shortcodeToEmoji = getShortcodeToCustomEmoji(roomTimeline.room);
+ const shortcodeToEmoji = getShortcodeToCustomEmoji(room);
+ const canSendReaction = room.currentState.maySendEvent('m.reaction', mx.getUserId());
const eventReactions = reactionTimeline.get(eventId);
const addReaction = (key, count, senderId, isActive) => {
/>
))
}
- <IconButton
- onClick={(e) => {
- pickEmoji(e, roomId, eventId, roomTimeline);
- }}
- src={EmojiAddIC}
- size="extra-small"
- tooltip="Add reaction"
- />
+ {canSendReaction && (
+ <IconButton
+ onClick={(e) => {
+ pickEmoji(e, roomId, eventId, roomTimeline);
+ }}
+ src={EmojiAddIC}
+ size="extra-small"
+ tooltip="Add reaction"
+ />
+ )}
</div>
);
}
const myPowerlevel = room.getMember(mx.getUserId())?.powerLevel;
const canIRedact = room.currentState.hasSufficientPowerLevelFor('redact', myPowerlevel);
+ const canSendReaction = room.currentState.maySendEvent('m.reaction', mx.getUserId());
return (
<div className="message__options">
- <IconButton
- onClick={(e) => pickEmoji(e, roomId, eventId, roomTimeline)}
- src={EmojiAddIC}
- size="extra-small"
- tooltip="Add reaction"
- />
+ {canSendReaction && (
+ <IconButton
+ onClick={(e) => pickEmoji(e, roomId, eventId, roomTimeline)}
+ src={EmojiAddIC}
+ size="extra-small"
+ tooltip="Add reaction"
+ />
+ )}
<IconButton
onClick={() => reply()}
src={ReplyArrowIC}