mirror of
https://github.com/vector-im/element-call.git
synced 2026-08-08 20:09:19 +00:00
More tidying
This commit is contained in:
@@ -78,15 +78,14 @@ export const ReactionsProvider = ({
|
|||||||
const supportsReactions =
|
const supportsReactions =
|
||||||
clientState?.state === "valid" && clientState.supportedFeatures.reactions;
|
clientState?.state === "valid" && clientState.supportedFeatures.reactions;
|
||||||
const room = rtcSession.room;
|
const room = rtcSession.room;
|
||||||
|
const myUserId = room.client.getUserId();
|
||||||
|
|
||||||
// Calculate our own reaction event.
|
// Calculate our own reaction event.
|
||||||
const myReactionId = useMemo((): string | null => {
|
const myReactionId = useMemo(
|
||||||
const myUserId = room.client.getUserId();
|
(): string | null =>
|
||||||
if (myUserId) {
|
(myUserId && raisedHands[myUserId]?.reactionEventId) ?? null,
|
||||||
return raisedHands[myUserId]?.reactionEventId;
|
[raisedHands, room],
|
||||||
}
|
);
|
||||||
return null;
|
|
||||||
}, [raisedHands, room]);
|
|
||||||
|
|
||||||
// Reduce the data down for the consumers.
|
// Reduce the data down for the consumers.
|
||||||
const resultRaisedHands = useMemo(
|
const resultRaisedHands = useMemo(
|
||||||
@@ -105,11 +104,9 @@ export const ReactionsProvider = ({
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const removeRaisedHand = useCallback((userId: string) => {
|
const removeRaisedHand = useCallback((userId: string) => {
|
||||||
delete raisedHands[userId];
|
setRaisedHands(
|
||||||
setRaisedHands((prevRaisedHands) => {
|
({ [userId]: _removed, ...remainingRaisedHands }) => remainingRaisedHands,
|
||||||
delete prevRaisedHands[userId];
|
);
|
||||||
return { ...prevRaisedHands };
|
|
||||||
});
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// This effect will check the state whenever the membership of the session changes.
|
// This effect will check the state whenever the membership of the session changes.
|
||||||
@@ -123,7 +120,7 @@ export const ReactionsProvider = ({
|
|||||||
EventType.Reaction,
|
EventType.Reaction,
|
||||||
);
|
);
|
||||||
const allEvents = relations?.getRelations() ?? [];
|
const allEvents = relations?.getRelations() ?? [];
|
||||||
return allEvents.length > 0 ? allEvents[0] : undefined;
|
return allEvents.find((u) => u.sender === myUserId);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Remove any raised hands for users no longer joined to the call.
|
// Remove any raised hands for users no longer joined to the call.
|
||||||
|
|||||||
Reference in New Issue
Block a user