Iterate title on confirm space action dialog
This commit is contained in:
parent
0f8069ac35
commit
886f8d31fb
2 changed files with 39 additions and 5 deletions
|
@ -541,6 +541,21 @@ const RoomKickButton = ({ room, member, startUpdating, stopUpdating }: Omit<IBas
|
|||
if (member.membership !== "invite" && member.membership !== "join") return null;
|
||||
|
||||
const onKick = async () => {
|
||||
let title: string;
|
||||
if (room.isSpaceRoom()) {
|
||||
if (member.membership === "invite") {
|
||||
title = _t("Disinvite this user from %(spaceName)s?", { spaceName: room.name });
|
||||
} else {
|
||||
title = _t("Kick this user from %(spaceName)s?", { spaceName: room.name });
|
||||
}
|
||||
} else {
|
||||
if (member.membership === "invite") {
|
||||
title = _t("Disinvite this user?");
|
||||
} else {
|
||||
title = _t("Kick this user?");
|
||||
}
|
||||
}
|
||||
|
||||
const { finished } = Modal.createTrackedDialog(
|
||||
'Confirm User Action Dialog',
|
||||
'onKick',
|
||||
|
@ -548,7 +563,7 @@ const RoomKickButton = ({ room, member, startUpdating, stopUpdating }: Omit<IBas
|
|||
{
|
||||
member,
|
||||
action: member.membership === "invite" ? _t("Disinvite") : _t("Kick"),
|
||||
title: member.membership === "invite" ? _t("Disinvite this user?") : _t("Kick this user?"),
|
||||
title,
|
||||
askReason: member.membership === "join",
|
||||
danger: true,
|
||||
// space-specific props
|
||||
|
@ -681,6 +696,21 @@ const BanToggleButton = ({ room, member, startUpdating, stopUpdating }: Omit<IBa
|
|||
|
||||
const isBanned = member.membership === "ban";
|
||||
const onBanOrUnban = async () => {
|
||||
let title: string;
|
||||
if (room.isSpaceRoom()) {
|
||||
if (isBanned) {
|
||||
title = _t("Unban this user from %(spaceName)s?", { spaceName: room.name });
|
||||
} else {
|
||||
title = _t("Ban this user from %(spaceName)s?", { spaceName: room.name });
|
||||
}
|
||||
} else {
|
||||
if (isBanned) {
|
||||
title = _t("Unban this user?");
|
||||
} else {
|
||||
title = _t("Ban this user?");
|
||||
}
|
||||
}
|
||||
|
||||
const { finished } = Modal.createTrackedDialog(
|
||||
'Confirm User Action Dialog',
|
||||
'onBanOrUnban',
|
||||
|
@ -688,7 +718,7 @@ const BanToggleButton = ({ room, member, startUpdating, stopUpdating }: Omit<IBa
|
|||
{
|
||||
member,
|
||||
action: isBanned ? _t("Unban") : _t("Ban"),
|
||||
title: isBanned ? _t("Unban this user?") : _t("Ban this user?"),
|
||||
title,
|
||||
askReason: !isBanned,
|
||||
danger: !isBanned,
|
||||
// space-specific props
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue