Fix useIsRoomE2EE()

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner 2023-08-25 15:30:58 +02:00
parent a73516380a
commit 9d142c1ea5
No known key found for this signature in database
GPG Key ID: D1D45825D60C24D2

View File

@ -67,15 +67,19 @@ export const useManageRoomSharedKey = (roomId: string): string | null => {
};
export const useIsRoomE2EE = (roomId: string): boolean | null => {
const { isEmbedded } = useUrlParams();
const client = useClient();
const room = useMemo(
() => client.client?.getRoom(roomId) ?? null,
[roomId, client.client]
);
const isE2EE = useMemo(
() => (room ? !room?.getCanonicalAlias() : null),
[room]
);
const isE2EE = useMemo(() => {
if (isEmbedded) {
return false;
} else {
return room ? !room?.getCanonicalAlias() : null;
}
}, [isEmbedded, room]);
return isE2EE;
};