feat(forward): Discord-style provenance — 'Forwarded from <sender> in <room> · <time>' with jump to the original
CI / Build & Quality Checks (push) Successful in 1m31s
CI / Docker image build & smoke test (push) Skipped
CI / Secret scan (gitleaks) (push) Successful in 7s
CI / Trigger Desktop Build (push) Successful in 5s
CI / Playwright smoke (e2e) (push) Successful in 2m7s

Forwarded events carried no origin at all; they read as the forwarder's own
words. buildForwardContent now stamps io.lotus.forwarded (sender, ts,
room_id, event_id; re-forwards keep the original stamp) and the main and
thread timelines render a reply-style header above the message that jumps
to the original when the viewer is in the source room (sender + time only
otherwise — the source room's name is not leaked). Unit-tested; verified
end to end with Playwright (header text, event content, jump, re-forward).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PPmy3tPq869XDW4njjVaKA
This commit is contained in:
2026-09-18 21:07:33 -04:00
co-authored by Claude Opus 5
parent 6460d0569c
commit 5fc90feef9
7 changed files with 231 additions and 39 deletions
+29 -12
View File
@@ -38,10 +38,13 @@ import { useMatrixClient } from '../../../hooks/useMatrixClient';
import { useVirtualPaginator, ItemRange } from '../../../hooks/useVirtualPaginator';
import { useAlive } from '../../../hooks/useAlive';
import { editableActiveElement, scrollToBottom } from '../../../utils/dom';
import { getForwardedMeta } from '../message/forwardContent';
import { useRoomNavigate } from '../../../hooks/useRoomNavigate';
import {
DefaultPlaceholder,
MessageBase,
Reply,
ForwardedHeader,
RedactedContent,
MSticker,
MessageUnsupportedContent,
@@ -267,6 +270,7 @@ export function ThreadTimeline({ room, thread, editor }: ThreadTimelineProps) {
const [encUrlPreview] = useSetting(settingsAtom, 'encUrlPreview');
const showUrlPreview = room.hasEncryptionStateEvent() ? encUrlPreview : urlPreview;
const [hour24Clock] = useSetting(settingsAtom, 'hour24Clock');
const { navigateRoom } = useRoomNavigate();
const [dateFormatString] = useSetting(settingsAtom, 'dateFormatString');
const direct = useIsDirectRoom();
@@ -731,6 +735,7 @@ export function ThreadTimeline({ room, thread, editor }: ThreadTimelineProps) {
const reactions = reactionRelations?.getSortedAnnotationsByKey();
const hasReactions = !!reactions && reactions.length > 0;
const { replyEventId, threadRootId } = mEvent;
const forwardedMeta = getForwardedMeta(mEvent.getContent());
return (
<Message
@@ -755,18 +760,29 @@ export function ThreadTimeline({ room, thread, editor }: ThreadTimelineProps) {
onReactionToggle={handleReactionToggle}
onEditId={opts.editable ? handleEdit : undefined}
reply={
replyEventId && (
<Reply
room={room}
timelineSet={timelineSet}
replyEventId={replyEventId}
threadRootId={threadRootId}
onClick={handleOpenReply}
getMemberPowerTag={getMemberPowerTag}
accessibleTagColors={accessiblePowerTagColors}
legacyUsernameColor={legacyUsernameColor || direct}
/>
)
<>
{forwardedMeta && (
<ForwardedHeader
mx={mx}
meta={forwardedMeta}
hour24Clock={hour24Clock}
dateFormatString={dateFormatString}
onJump={() => navigateRoom(forwardedMeta.room_id, forwardedMeta.event_id)}
/>
)}
{replyEventId && (
<Reply
room={room}
timelineSet={timelineSet}
replyEventId={replyEventId}
threadRootId={threadRootId}
onClick={handleOpenReply}
getMemberPowerTag={getMemberPowerTag}
accessibleTagColors={accessiblePowerTagColors}
legacyUsernameColor={legacyUsernameColor || direct}
/>
)}
</>
}
reactions={
reactionRelations && (
@@ -794,6 +810,7 @@ export function ThreadTimeline({ room, thread, editor }: ThreadTimelineProps) {
);
},
[
navigateRoom,
room,
messageSpacing,
messageLayout,