Room-history export shows outdated content and a garbled duplicate line for edited messages #50

Closed
opened 2026-09-12 01:51:14 -04:00 by jared · 0 comments
Owner

Severity: medium · Type: bug · Confidence: high

Location: src/app/features/room-settings/ExportRoomHistory.tsx:90-127

Problem

addEvents only filters on ev.getType() !== EventType.RoomMessage and takes content.body verbatim; it never looks at m.relates_to.rel_type === 'm.replace'. An edited message therefore produces two lines in the export: the original (pre-edit) body, unioned with a second, separate entry for the edit event itself, whose content.body is normally the client-fallback text ("* <new text>") rather than the clean edited content (m.new_content.body). The export thus both omits the true final content under the original timestamp and inserts a confusing duplicate line prefixed with *.

How to trigger

Export any room's history (txt/json/html) that contains an edited message. The exported file contains the stale original text plus a separate "* corrected text" line instead of one entry with the final edited body.

Suggested fix

When collecting events, detect m.replace relations and either skip the replacement event from being added as its own row while substituting m.new_content.body into the original event's row, or explicitly render it as "(edited)" using the latest content — mirroring how LiveBookmarkItem in BookmarksPanel.tsx already resolves edits via useRoomEvent.


Filed from the September 2026 client audit (branch lotus @ 4bea4895).

**Severity:** medium · **Type:** bug · **Confidence:** high **Location:** `src/app/features/room-settings/ExportRoomHistory.tsx:90-127` ### Problem `addEvents` only filters on `ev.getType() !== EventType.RoomMessage` and takes `content.body` verbatim; it never looks at `m.relates_to.rel_type === 'm.replace'`. An edited message therefore produces two lines in the export: the original (pre-edit) body, unioned with a second, separate entry for the edit event itself, whose `content.body` is normally the client-fallback text (`"* <new text>"`) rather than the clean edited content (`m.new_content.body`). The export thus both omits the true final content under the original timestamp and inserts a confusing duplicate line prefixed with `*`. ### How to trigger Export any room's history (txt/json/html) that contains an edited message. The exported file contains the stale original text plus a separate "* corrected text" line instead of one entry with the final edited body. ### Suggested fix When collecting events, detect `m.replace` relations and either skip the replacement event from being added as its own row while substituting `m.new_content.body` into the original event's row, or explicitly render it as "(edited)" using the latest content — mirroring how `LiveBookmarkItem` in `BookmarksPanel.tsx` already resolves edits via `useRoomEvent`. --- --- _Filed from the September 2026 client audit (branch `lotus` @ 4bea4895)._
jared added this to the Audit 2026-09 · Medium & Low milestone 2026-09-12 01:51:14 -04:00
jared added the bugpriority: mediumarea: navigation labels 2026-09-12 01:51:14 -04:00
jared self-assigned this 2026-09-12 01:51:14 -04:00
jared closed this issue 2026-09-12 20:29:09 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
2026-11-14
Dependencies

No dependencies set.

Reference: LotusGuild/cinny#50