Iterate title on confirm space action dialog

pull/21833/head
Michael Telatynski 2021-09-28 16:23:42 +01:00
parent 0f8069ac35
commit 886f8d31fb
2 changed files with 39 additions and 5 deletions

View File

@ -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

View File

@ -1845,10 +1845,12 @@
"You will not be able to undo this change as you are demoting yourself, if you are the last privileged user in the space it will be impossible to regain privileges.": "You will not be able to undo this change as you are demoting yourself, if you are the last privileged user in the space it will be impossible to regain privileges.",
"You will not be able to undo this change as you are demoting yourself, if you are the last privileged user in the room it will be impossible to regain privileges.": "You will not be able to undo this change as you are demoting yourself, if you are the last privileged user in the room it will be impossible to regain privileges.",
"Demote": "Demote",
"Disinvite": "Disinvite",
"Kick": "Kick",
"Disinvite this user from %(spaceName)s?": "Disinvite this user from %(spaceName)s?",
"Kick this user from %(spaceName)s?": "Kick this user from %(spaceName)s?",
"Disinvite this user?": "Disinvite this user?",
"Kick this user?": "Kick this user?",
"Disinvite": "Disinvite",
"Kick": "Kick",
"Kick them from everything I'm able to": "Kick them from everything I'm able to",
"Kick them from specific things I'm able to": "Kick them from specific things I'm able to",
"If you're not an admin of a room or space in <SpaceName/>, they'll still be able to access it after you kick them.": "If you're not an admin of a room or space in <SpaceName/>, they'll still be able to access it after you kick them.",
@ -1862,9 +1864,11 @@
"Remove %(count)s messages|other": "Remove %(count)s messages",
"Remove %(count)s messages|one": "Remove 1 message",
"Remove recent messages": "Remove recent messages",
"Ban": "Ban",
"Unban this user from %(spaceName)s?": "Unban this user from %(spaceName)s?",
"Ban this user from %(spaceName)s?": "Ban this user from %(spaceName)s?",
"Unban this user?": "Unban this user?",
"Ban this user?": "Ban this user?",
"Ban": "Ban",
"Unban them from everything I'm able to": "Unban them from everything I'm able to",
"Ban them from everything I'm able to": "Ban them from everything I'm able to",
"Unban them from specific things I'm able to": "Unban them from specific things I'm able to",