Revert 'Hide the names of banned users behind a spoiler tag#32424' (#32635)

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

* Empty commit to trigger test re-run
This commit is contained in:
Andy Balaam
2026-02-25 15:53:30 +00:00
committed by GitHub
parent f6d72f12db
commit 59ccc1111a
6 changed files with 13 additions and 144 deletions
+5 -22
View File
@@ -39,7 +39,6 @@ import { highlightEvent, isLocationEvent } from "./utils/EventUtils";
import { getSenderName } from "./utils/event/getSenderName";
import PosthogTrackers from "./PosthogTrackers.ts";
import { ElementCallEventType } from "./call-types.ts";
import Spoiler from "./components/views/elements/Spoiler.tsx";
function getRoomMemberDisplayname(client: MatrixClient, event: MatrixEvent, userId = event.getSender()): string {
const roomId = event.getRoomId();
@@ -108,7 +107,7 @@ function textForMemberEvent(
client: MatrixClient,
allowJSX: boolean,
showHiddenEvents?: boolean,
): (() => Renderable) | null {
): (() => string) | null {
// XXX: SYJS-16 "sender is sometimes null for join messages"
const senderName = ev.sender?.name || getRoomMemberDisplayname(client, ev);
const targetName = ev.target?.name || getRoomMemberDisplayname(client, ev, ev.getStateKey());
@@ -134,26 +133,10 @@ function textForMemberEvent(
}
}
case KnownMembership.Ban:
if (allowJSX) {
return reason
? () =>
_t(
"timeline|m.room.member|ban_reason_spoiler",
{ senderName, reason },
{ user: () => <Spoiler>{targetName}</Spoiler> },
)
: () =>
_t(
"timeline|m.room.member|ban_spoiler",
{ senderName },
{ user: () => <Spoiler>{targetName}</Spoiler> },
);
}
return reason
? () => _t("timeline|m.room.member|ban_reason", { senderName, reason })
: () => _t("timeline|m.room.member|ban", { senderName });
return () =>
reason
? _t("timeline|m.room.member|ban_reason", { senderName, targetName, reason })
: _t("timeline|m.room.member|ban", { senderName, targetName });
case KnownMembership.Join:
if (prevContent && prevContent.membership === KnownMembership.Join) {
const modDisplayname = getModification(prevContent.displayname, content.displayname);
@@ -8,7 +8,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Com
Please see LICENSE files in the repository root for full details.
*/
import React, { type ReactElement, type ComponentProps, type ReactNode } from "react";
import React, { type ComponentProps, type ReactNode } from "react";
import { EventType, type MatrixEvent, MatrixEventEvent, type RoomMember } from "matrix-js-sdk/src/matrix";
import { KnownMembership } from "matrix-js-sdk/src/types";
import { throttle } from "lodash";
@@ -25,7 +25,6 @@ import AccessibleButton from "./AccessibleButton";
import RoomContext from "../../../contexts/RoomContext";
import { arrayHasDiff } from "../../../utils/arrays.ts";
import { objectHasDiff } from "../../../utils/objects.ts";
import Spoiler from "./Spoiler.tsx";
const onPinnedMessagesClick = (): void => {
RightPanelStore.instance.setCard({ phase: RightPanelPhases.PinnedMessages }, false);
@@ -223,15 +222,7 @@ export default class EventListSummary extends React.Component<Props, State> {
): ReactNode {
const summaries = orderedTransitionSequences.map((transitions) => {
const userNames = eventAggregates[transitions];
let spoileredUserNames: ReactElement[];
if (containsBanned(transitions)) {
spoileredUserNames = userNames.map((u) => <Spoiler key={u}>{u}</Spoiler>);
} else {
spoileredUserNames = userNames.map((u) => <>{u}</>);
}
const nameList = this.renderNameList(spoileredUserNames);
const nameList = this.renderNameList(userNames);
const splitTransitions = transitions.split(SEP) as TransitionType[];
@@ -243,11 +234,7 @@ export default class EventListSummary extends React.Component<Props, State> {
const coalescedTransitions = EventListSummary.coalesceRepeatedTransitions(canonicalTransitions);
const descs = coalescedTransitions.map((t) => {
return EventListSummary.getDescriptionForTransition(
t.transitionType,
spoileredUserNames.length,
t.repeats,
);
return EventListSummary.getDescriptionForTransition(t.transitionType, userNames.length, t.repeats);
});
const desc = formatList(descs);
@@ -268,7 +255,7 @@ export default class EventListSummary extends React.Component<Props, State> {
* more items in `users` than `this.props.summaryLength`, which is the number of names
* included before "and [n] others".
*/
private renderNameList(users: ReactElement[]): ReactElement {
private renderNameList(users: string[]): string {
return formatList(users, this.props.summaryLength);
}
@@ -631,11 +618,3 @@ export default class EventListSummary extends React.Component<Props, State> {
);
}
}
/**
* Returns true if the provided list comma-separated list of transitions
* contains an item "banned".
*/
function containsBanned(transitions: string): boolean {
return transitions.startsWith(TransitionType.Banned) || transitions.includes(`,${TransitionType.Banned}`);
}
+2 -4
View File
@@ -3483,10 +3483,8 @@
"m.room.member": {
"accepted_3pid_invite": "%(targetName)s accepted the invitation for %(displayName)s",
"accepted_invite": "%(targetName)s accepted an invitation",
"ban": "%(senderName)s banned a user",
"ban_reason": "%(senderName)s banned a user: %(reason)s",
"ban_reason_spoiler": "%(senderName)s banned <user/>: %(reason)s",
"ban_spoiler": "%(senderName)s banned <user/>",
"ban": "%(senderName)s banned %(targetName)s",
"ban_reason": "%(senderName)s banned %(targetName)s: %(reason)s",
"change_avatar": "%(senderName)s changed their profile picture",
"change_name": "%(oldDisplayName)s changed their display name to %(displayName)s",
"change_name_avatar": "%(oldDisplayName)s changed their display name and profile picture",