Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Change "Ban" to "Ban from room" to fix an inconsistency in the Admin Tools dialog #8281

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/components/views/right_panel/UserInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ function useHasCrossSigningKeys(cli: MatrixClient, member: User, canVerify: bool
}, [cli, member, canVerify], undefined);
}

function DeviceItem({ userId, device }: {userId: string, device: IDevice}) {
function DeviceItem({ userId, device }: { userId: string, device: IDevice }) {
const cli = useContext(MatrixClientContext);
const isMe = userId === cli.getUserId();
const deviceTrust = cli.checkDeviceTrust(userId, device.deviceId);
Expand Down Expand Up @@ -239,7 +239,7 @@ function DeviceItem({ userId, device }: {userId: string, device: IDevice}) {
}
}

function DevicesSection({ devices, userId, loading }: {devices: IDevice[], userId: string, loading: boolean}) {
function DevicesSection({ devices, userId, loading }: { devices: IDevice[], userId: string, loading: boolean }) {
const cli = useContext(MatrixClientContext);
const userTrust = cli.checkUserTrust(userId);

Expand Down Expand Up @@ -653,7 +653,9 @@ const BanToggleButton = ({ room, member, startUpdating, stopUpdating }: Omit<IBa
room.isSpaceRoom() ? ConfirmSpaceUserActionDialog : ConfirmUserActionDialog,
{
member,
action: isBanned ? _t("Unban") : _t("Ban"),
action: room.isSpaceRoom()
? (isBanned ? _t("Unban from space") : _t("Ban from space"))
: (isBanned ? _t("Unban from room") : _t("Ban from room")),
title: isBanned
? _t("Unban from %(roomName)s", { roomName: room.name })
: _t("Ban from %(roomName)s", { roomName: room.name }),
Expand Down Expand Up @@ -719,9 +721,13 @@ const BanToggleButton = ({ room, member, startUpdating, stopUpdating }: Omit<IBa
});
};

let label = _t("Ban");
let label = room.isSpaceRoom()
? _t("Ban from space")
: _t("Ban from room");
if (isBanned) {
label = _t("Unban");
label = room.isSpaceRoom()
? _t("Unban from space")
: _t("Unban from room");
}

const classes = classNames("mx_UserInfo_field", {
Expand Down
5 changes: 4 additions & 1 deletion src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -1987,7 +1987,10 @@
"Failed to remove user": "Failed to remove user",
"Remove from room": "Remove from room",
"Remove recent messages": "Remove recent messages",
"Ban": "Ban",
"Unban from space": "Unban from space",
"Ban from space": "Ban from space",
"Unban from room": "Unban from room",
"Ban from room": "Ban from room",
"Unban from %(roomName)s": "Unban from %(roomName)s",
"Ban from %(roomName)s": "Ban from %(roomName)s",
"Unban them from everything I'm able to": "Unban them from everything I'm able to",
Expand Down