Hide reaction picker for user without permission
Signed-off-by: Ajay Bura <ajbura@gmail.com>
This commit is contained in:
parent
992da7c7be
commit
202ff53c41
1 changed files with 22 additions and 16 deletions
|
@ -354,11 +354,12 @@ MessageReaction.propTypes = {
|
||||||
};
|
};
|
||||||
|
|
||||||
function MessageReactionGroup({ roomTimeline, mEvent }) {
|
function MessageReactionGroup({ roomTimeline, mEvent }) {
|
||||||
const { roomId, reactionTimeline } = roomTimeline;
|
const { roomId, room, reactionTimeline } = roomTimeline;
|
||||||
const eventId = mEvent.getId();
|
const eventId = mEvent.getId();
|
||||||
const mx = initMatrix.matrixClient;
|
const mx = initMatrix.matrixClient;
|
||||||
const reactions = {};
|
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 eventReactions = reactionTimeline.get(eventId);
|
||||||
const addReaction = (key, count, senderId, isActive) => {
|
const addReaction = (key, count, senderId, isActive) => {
|
||||||
|
@ -416,14 +417,16 @@ function MessageReactionGroup({ roomTimeline, mEvent }) {
|
||||||
/>
|
/>
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
<IconButton
|
{canSendReaction && (
|
||||||
onClick={(e) => {
|
<IconButton
|
||||||
pickEmoji(e, roomId, eventId, roomTimeline);
|
onClick={(e) => {
|
||||||
}}
|
pickEmoji(e, roomId, eventId, roomTimeline);
|
||||||
src={EmojiAddIC}
|
}}
|
||||||
size="extra-small"
|
src={EmojiAddIC}
|
||||||
tooltip="Add reaction"
|
size="extra-small"
|
||||||
/>
|
tooltip="Add reaction"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -452,15 +455,18 @@ const MessageOptions = React.memo(({
|
||||||
|
|
||||||
const myPowerlevel = room.getMember(mx.getUserId())?.powerLevel;
|
const myPowerlevel = room.getMember(mx.getUserId())?.powerLevel;
|
||||||
const canIRedact = room.currentState.hasSufficientPowerLevelFor('redact', myPowerlevel);
|
const canIRedact = room.currentState.hasSufficientPowerLevelFor('redact', myPowerlevel);
|
||||||
|
const canSendReaction = room.currentState.maySendEvent('m.reaction', mx.getUserId());
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="message__options">
|
<div className="message__options">
|
||||||
<IconButton
|
{canSendReaction && (
|
||||||
onClick={(e) => pickEmoji(e, roomId, eventId, roomTimeline)}
|
<IconButton
|
||||||
src={EmojiAddIC}
|
onClick={(e) => pickEmoji(e, roomId, eventId, roomTimeline)}
|
||||||
size="extra-small"
|
src={EmojiAddIC}
|
||||||
tooltip="Add reaction"
|
size="extra-small"
|
||||||
/>
|
tooltip="Add reaction"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={() => reply()}
|
onClick={() => reply()}
|
||||||
src={ReplyArrowIC}
|
src={ReplyArrowIC}
|
||||||
|
|
Loading…
Reference in a new issue