fix: show deletion reason as primary text on redacted messages
This commit is contained in:
@@ -506,8 +506,6 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli
|
||||
smooth: true,
|
||||
});
|
||||
|
||||
const redactedBodyCache = useRef<Map<string, string>>(new Map());
|
||||
|
||||
const [focusItem, setFocusItem] = useState<
|
||||
| {
|
||||
index: number;
|
||||
@@ -1037,14 +1035,6 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli
|
||||
const getContent = (() =>
|
||||
editedEvent?.getContent()['m.new_content'] ?? mEvent.getContent()) as GetContentCallback;
|
||||
|
||||
// Cache body before it can be stripped by redaction
|
||||
if (!mEvent.isRedacted()) {
|
||||
const c = mEvent.getContent();
|
||||
if (c.body && ['m.text', 'm.notice', 'm.emote'].includes(c.msgtype ?? '')) {
|
||||
redactedBodyCache.current.set(mEventId, c.body);
|
||||
}
|
||||
}
|
||||
|
||||
const senderId = mEvent.getSender() ?? '';
|
||||
const senderDisplayName =
|
||||
getMemberDisplayName(room, senderId) ?? getMxIdLocalPart(senderId) ?? senderId;
|
||||
@@ -1106,10 +1096,7 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli
|
||||
dateFormatString={dateFormatString}
|
||||
>
|
||||
{mEvent.isRedacted() ? (
|
||||
<RedactedContent
|
||||
reason={mEvent.getUnsigned().redacted_because?.content.reason}
|
||||
originalBody={redactedBodyCache.current.get(mEventId)}
|
||||
/>
|
||||
<RedactedContent reason={mEvent.getUnsigned().redacted_because?.content.reason} />
|
||||
) : (
|
||||
<RenderMessageContent
|
||||
displayName={senderDisplayName}
|
||||
|
||||
Reference in New Issue
Block a user