Add warning that some spaces may not be relinked to the newly upgraded room
This commit is contained in:
parent
85fea9cfd0
commit
b8ee2d2b5b
2 changed files with 43 additions and 16 deletions
|
@ -28,6 +28,7 @@ import { MatrixClientPeg } from "../../../MatrixClientPeg";
|
||||||
import Modal from "../../../Modal";
|
import Modal from "../../../Modal";
|
||||||
import ManageRestrictedJoinRuleDialog from "../dialogs/ManageRestrictedJoinRuleDialog";
|
import ManageRestrictedJoinRuleDialog from "../dialogs/ManageRestrictedJoinRuleDialog";
|
||||||
import RoomUpgradeWarningDialog from "../dialogs/RoomUpgradeWarningDialog";
|
import RoomUpgradeWarningDialog from "../dialogs/RoomUpgradeWarningDialog";
|
||||||
|
import QuestionDialog from "../dialogs/QuestionDialog";
|
||||||
import { upgradeRoom } from "../../../utils/RoomUpgrade";
|
import { upgradeRoom } from "../../../utils/RoomUpgrade";
|
||||||
import { arrayHasDiff } from "../../../utils/arrays";
|
import { arrayHasDiff } from "../../../utils/arrays";
|
||||||
import { useLocalEcho } from "../../../hooks/useLocalEcho";
|
import { useLocalEcho } from "../../../hooks/useLocalEcho";
|
||||||
|
@ -207,13 +208,37 @@ const JoinRuleSettings = ({ room, promptUpgrade, onError, beforeChange, closeSet
|
||||||
} else if (preferredRestrictionVersion) {
|
} else if (preferredRestrictionVersion) {
|
||||||
// Block this action on a room upgrade otherwise it'd make their room unjoinable
|
// Block this action on a room upgrade otherwise it'd make their room unjoinable
|
||||||
const targetVersion = preferredRestrictionVersion;
|
const targetVersion = preferredRestrictionVersion;
|
||||||
Modal.createTrackedDialog('Restricted join rule upgrade', '', RoomUpgradeWarningDialog, {
|
|
||||||
|
const modal = Modal.createTrackedDialog('Restricted join rule upgrade', '', RoomUpgradeWarningDialog, {
|
||||||
roomId: room.roomId,
|
roomId: room.roomId,
|
||||||
targetVersion,
|
targetVersion,
|
||||||
description: _t("This upgrade will allow members of selected spaces " +
|
description: _t("This upgrade will allow members of selected spaces " +
|
||||||
"access to this room without an invite."),
|
"access to this room without an invite."),
|
||||||
onFinished: async (resp) => {
|
});
|
||||||
|
|
||||||
|
const [resp] = await modal.finished;
|
||||||
if (!resp?.continue) return;
|
if (!resp?.continue) return;
|
||||||
|
|
||||||
|
const userId = cli.getUserId();
|
||||||
|
const unableToUpdateSomeParents = Array.from(SpaceStore.instance.getKnownParents(room.roomId))
|
||||||
|
.some(roomId => !cli.getRoom(roomId)?.currentState.maySendStateEvent(EventType.SpaceChild, userId));
|
||||||
|
if (unableToUpdateSomeParents) {
|
||||||
|
const modal = Modal.createTrackedDialog<[boolean]>('Parent relink warning', '', QuestionDialog, {
|
||||||
|
title: _t("Before you upgrade"),
|
||||||
|
description: (
|
||||||
|
<div>{ _t("This room is in some spaces you’re not an admin of. " +
|
||||||
|
"In those spaces, the old room will still be shown, " +
|
||||||
|
"but people will be prompted to join the new one.") }</div>
|
||||||
|
),
|
||||||
|
hasCancelButton: true,
|
||||||
|
button: _t("Upgrade anyway"),
|
||||||
|
danger: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
const [shouldUpgrade] = await modal.finished;
|
||||||
|
if (!shouldUpgrade) return;
|
||||||
|
}
|
||||||
|
|
||||||
const roomId = await upgradeRoom(room, targetVersion, resp.invite, true, true, true);
|
const roomId = await upgradeRoom(room, targetVersion, resp.invite, true, true, true);
|
||||||
closeSettingsFn();
|
closeSettingsFn();
|
||||||
// switch to the new room in the background
|
// switch to the new room in the background
|
||||||
|
@ -226,8 +251,7 @@ const JoinRuleSettings = ({ room, promptUpgrade, onError, beforeChange, closeSet
|
||||||
action: "open_room_settings",
|
action: "open_room_settings",
|
||||||
initial_tab_id: ROOM_SECURITY_TAB,
|
initial_tab_id: ROOM_SECURITY_TAB,
|
||||||
});
|
});
|
||||||
},
|
|
||||||
});
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1162,6 +1162,9 @@
|
||||||
"Anyone in a space can find and join. You can select multiple spaces.": "Anyone in a space can find and join. You can select multiple spaces.",
|
"Anyone in a space can find and join. You can select multiple spaces.": "Anyone in a space can find and join. You can select multiple spaces.",
|
||||||
"Space members": "Space members",
|
"Space members": "Space members",
|
||||||
"This upgrade will allow members of selected spaces access to this room without an invite.": "This upgrade will allow members of selected spaces access to this room without an invite.",
|
"This upgrade will allow members of selected spaces access to this room without an invite.": "This upgrade will allow members of selected spaces access to this room without an invite.",
|
||||||
|
"Before you upgrade": "Before you upgrade",
|
||||||
|
"This room is in some spaces you’re not an admin of. In those spaces, the old room will still be shown, but people will be prompted to join the new one.": "This room is in some spaces you’re not an admin of. In those spaces, the old room will still be shown, but people will be prompted to join the new one.",
|
||||||
|
"Upgrade anyway": "Upgrade anyway",
|
||||||
"Message layout": "Message layout",
|
"Message layout": "Message layout",
|
||||||
"IRC": "IRC",
|
"IRC": "IRC",
|
||||||
"Modern": "Modern",
|
"Modern": "Modern",
|
||||||
|
|
Loading…
Reference in a new issue