mirror of
https://github.com/element-hq/element-call.git
synced 2026-10-23 10:52:38 +00:00
Hopefully actually fix password bug
This commit is contained in:
1 parent
4f43402299
commit
ed0059c898
1 file changed
+8
-3
@@ -35,7 +35,7 @@ const useInternalRoomSharedKey = (
|
||||
return [e2eeEnabled ? roomSharedKey : null, setRoomSharedKey];
|
||||
};
|
||||
|
||||
const useKeyFromUrl = (roomId: string) => {
|
||||
const useKeyFromUrl = (roomId: string): string | null => {
|
||||
const urlParams = useUrlParams();
|
||||
const [e2eeSharedKey, setE2EESharedKey] = useInternalRoomSharedKey(roomId);
|
||||
|
||||
@@ -46,13 +46,18 @@ const useKeyFromUrl = (roomId: string) => {
|
||||
|
||||
setE2EESharedKey(urlParams.password);
|
||||
}, [urlParams, e2eeSharedKey, setE2EESharedKey]);
|
||||
|
||||
return urlParams.password ?? null;
|
||||
};
|
||||
|
||||
export const useRoomSharedKey = (roomId: string): string | null => {
|
||||
// make sure we've extracted the key from the URL first
|
||||
useKeyFromUrl(roomId);
|
||||
// (and we still need to take the value it returns because
|
||||
// the effect won't run in time for it to save to localstorage in
|
||||
// time for us to read it out again).
|
||||
const passwordFormUrl = useKeyFromUrl(roomId);
|
||||
|
||||
return useInternalRoomSharedKey(roomId)[0];
|
||||
return useInternalRoomSharedKey(roomId)[0] ?? passwordFormUrl;
|
||||
};
|
||||
|
||||
export const useManageRoomSharedKey = (roomId: string): string | null => {
|
||||
|
||||
Reference in new issue
Block a user