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

Commit

Permalink
Change "Ban" to "Ban from room" to fix an inconsistency in the Admin …
Browse files Browse the repository at this point in the history
…Tools dialog (#8281)

* fix-admin-tools-phrase-inconsistency

* correctly specify space room action

* run i18n

* Apply suggestions from code review

Revert the applied formatting.

Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>

Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
  • Loading branch information
EECvision and t3chguy authored Apr 14, 2022
1 parent eb1d9b8 commit 8eaae6b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
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 @@ -1992,7 +1992,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

0 comments on commit 8eaae6b

Please sign in to comment.