Always allow setting a password

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner 2023-08-16 15:39:55 +02:00
parent 3ea908c59f
commit d0fe055af6
No known key found for this signature in database
GPG Key ID: D1D45825D60C24D2

View File

@ -26,12 +26,12 @@ export const getRoomSharedKeyLocalStorageKey = (roomId: string): string =>
export const useInternalRoomSharedKey = (
roomId: string
): [string | null, ((value: string) => void) | null] => {
): [string | null, (value: string) => void] => {
const key = useMemo(() => getRoomSharedKeyLocalStorageKey(roomId), [roomId]);
const [e2eeEnabled] = useEnableE2EE();
const [roomSharedKey, setRoomSharedKey] = useLocalStorage(key);
return e2eeEnabled ? [roomSharedKey, setRoomSharedKey] : [null, null];
return [e2eeEnabled ? roomSharedKey : null, setRoomSharedKey];
};
export const useRoomSharedKey = (roomId: string): string | null => {
@ -47,7 +47,7 @@ export const useManageRoomSharedKey = (roomId: string): string | null => {
if (password === "") return;
if (password === e2eeSharedKey) return;
setE2EESharedKey?.(password);
setE2EESharedKey(password);
}, [password, e2eeSharedKey, setE2EESharedKey]);
useEffect(() => {