mirror of
https://github.com/Novaloop-AG/healthchat-web.git
synced 2026-11-11 02:38:39 +00:00
Fix link modal not shown after access upgrade (#12411)
* Fix link modal not shown after access upgrade We dont show the modal since there was a mistake in the isRoomJoinable function. It used a state variable instead of reacomputing the join rule with room.getJoinRule() The state is a captured variable that from before the link share click -> does not update at that time. * dont shadow var
This commit is contained in:
@@ -79,7 +79,6 @@ export const CallGuestLinkButton: React.FC<{ room: Room }> = ({ room }) => {
|
|||||||
// If the user cannot invite the Knocking is not given as an option.
|
// If the user cannot invite the Knocking is not given as an option.
|
||||||
canInvite,
|
canInvite,
|
||||||
}).finished.then(() => {
|
}).finished.then(() => {
|
||||||
// we need to use the function here because the callback got called before the state was updated.
|
|
||||||
if (isRoomJoinable()) showLinkModal();
|
if (isRoomJoinable()) showLinkModal();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,10 @@ export const useGuestAccessInformation = (room: Room): GuestAccessInformation =>
|
|||||||
[canChangeJoinRule, isRoomJoinable, guestSpaUrl],
|
[canChangeJoinRule, isRoomJoinable, guestSpaUrl],
|
||||||
);
|
);
|
||||||
|
|
||||||
const isRoomJoinableFunction = (): boolean =>
|
const isRoomJoinableFunction = (): boolean => {
|
||||||
room.getJoinRule() === JoinRule.Public || (joinRule === JoinRule.Knock && room.canInvite(room.myUserId));
|
const join = room.getJoinRule();
|
||||||
|
return join === JoinRule.Public || (join === JoinRule.Knock && room.canInvite(room.myUserId));
|
||||||
|
};
|
||||||
|
|
||||||
return { canInviteGuests, guestSpaUrl, isRoomJoinable: isRoomJoinableFunction, canInvite };
|
return { canInviteGuests, guestSpaUrl, isRoomJoinable: isRoomJoinableFunction, canInvite };
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user