Skip to content

Comments

Hide the names of banned users behind a spoiler tag#32424

Open
andybalaam wants to merge 1 commit intodevelopfrom
andybalaam/spoiler-banned-names
Open

Hide the names of banned users behind a spoiler tag#32424
andybalaam wants to merge 1 commit intodevelopfrom
andybalaam/spoiler-banned-names

Conversation

@andybalaam
Copy link
Member

@andybalaam andybalaam commented Feb 9, 2026

Make banned users' names (which may be offensive) hidden by default.

Demo

rec-2026-02-09_16.43.32.mp4

@t3chguy t3chguy changed the title WIP: spoilers on banned names WIP: spoilers on banned users' names Feb 9, 2026
@t3chguy
Copy link
Member

t3chguy commented Feb 9, 2026

Tweaked title, originally thought "banned names" was like profanity detection or something

@jimmackenzie
Copy link

T&S team feedback: this is a welcome change - it materially improves the status quo.

Longer term, we'd be interested in exploring whether those events should be displayed in the timeline, or be viewable elsewhere. This is a welcome incremental change while we debate that question!

Comment on lines 139 to 141
? _t("timeline|m.room.member|ban_reason", { senderName, targetName: "<<TARGET>>", reason })
: _t("timeline|m.room.member|ban", { senderName, targetName: "<<TARGET>>" });
const targetI = text.indexOf("<<TARGET>>");
Copy link
Member

@t3chguy t3chguy Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is all sorts of wild, we should not be doing things like this, the 3rd param to _t can apply React element replacers, it may need updates to the i18n strings but that is worth everyone's collective sanity. Again see textForJoinRulesEvent for an example.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, didn't think this was the right way! Hopefully better attempt in 42986fc

@t3chguy
Copy link
Member

t3chguy commented Feb 20, 2026

Going to request design review as spoilers are something which is seldom seen by users and not sure if design ever signed them off, this will be putting them a lot more front and centre

@t3chguy t3chguy requested a review from a team February 20, 2026 09:10
@amshakal
Copy link
Member

I think this is a wonderful idea. Is it using the same spolier UI we already have on element web?

@t3chguy
Copy link
Member

t3chguy commented Feb 20, 2026

@amshakal yes it is, with the known issue that spoilers do not work for users relying on accessible technologies such as screen readers

Comment on lines 137 to 163
return allowJSX
? reason
? () =>
_t(
"timeline|m.room.member|ban_reason_spoiler",
{
senderName,
reason,
},
{
user: () => <Spoiler>{targetName}</Spoiler>,
},
)
: () =>
_t(
"timeline|m.room.member|ban_spoiler",
{
senderName,
reason,
},
{
user: () => <Spoiler>{targetName}</Spoiler>,
},
)
: reason
? () => _t("timeline|m.room.member|ban_reason", { senderName, targetName, reason })
: () => _t("timeline|m.room.member|ban", { senderName, targetName });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please no, nested ternary is hellish. I suggest looking at the previous example I pointed you to for something to copy

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in latest.

Copy link
Member

@t3chguy t3chguy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM otherwise

@andybalaam andybalaam force-pushed the andybalaam/spoiler-banned-names branch from 948a1dd to 8244607 Compare February 20, 2026 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants