Skip to content

fix(desktop): fold kind 40003 edit content into forum posts and comments - #6605

Open
BradGroux wants to merge 1 commit into
block:mainfrom
BradGroux:fix/forum-edit-folding
Open

fix(desktop): fold kind 40003 edit content into forum posts and comments#6605
BradGroux wants to merge 1 commit into
block:mainfrom
BradGroux:fix/forum-edit-folding

Conversation

@BradGroux

Copy link
Copy Markdown
Contributor

Summary

Desktop already fetches kind:40003 edit events alongside forum posts and thread replies, but only uses them for link-preview suppression. The edit content is never applied to the original message, so users always see the original text even after a successful edit — the relay has the new content, the CLI thread view shows it, but Desktop discards it.

Added fold_edit_content, which finds the latest valid 40003 edit for a given original event and returns its content. A valid edit must be signed by the original author or the author's verified agent owner (same authorization model as the existing link_preview_suppression_targets path). Applied in both get_forum_posts and get_forum_thread so edited content shows in both the channel list and the thread view.

This does not add an edit affordance in the UI — it fixes the data layer so that edits made via CLI or relay are visible in Desktop. The UI edit button is a separate enhancement.

Related issue

Closes #6433

Testing

Six new unit tests in forum.rs:

  • fold_edit_content_applies_author_edit — author signs an edit, content is replaced.
  • fold_edit_content_applies_owner_edit — verified agent owner signs an edit, content is replaced.
  • fold_edit_content_rejects_unauthorized_signer — edit from a random key is ignored.
  • fold_edit_content_latest_edit_wins — among two valid edits, the higher created_at wins.
  • fold_edit_content_ignores_edit_targeting_different_event — edit with an e tag pointing at a different event is ignored.
  • fold_edit_content_no_edits_returns_none — no edits means the original content is used.

The existing suppression_targets_accepts_author_and_verified_owner_only test is unchanged. Cannot run the full cargo test suite from this host (no Rust toolchain). The build and test gate will be verified on CI.

Desktop already fetches kind:40003 edit events alongside forum posts and
thread replies, but only uses them for link-preview suppression. The
edit content is never applied to the original message, so users always
see the original text even after a successful edit.

Added fold_edit_content, which finds the latest valid 40003 edit for a
given original event and returns its content. A valid edit must be
signed by the original author or the author's verified agent owner
(same authorization as the existing link-preview suppression path).
Applied in both get_forum_posts and get_forum_thread so edited content
shows in both the channel list and the thread view.

Six new unit tests cover: author edit, owner edit, unauthorized
signer rejection, latest-edit-wins ordering, wrong-target rejection,
and the no-edits case.

Closes block#6433

Co-authored-by: Brad Groux <brad@digitalmeld.com>
Signed-off-by: Brad Groux <brad@digitalmeld.com>
@BradGroux
BradGroux requested a review from a team as a code owner August 23, 2026 03:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Forum posts and comments cannot be edited: Desktop discards the kind:40003 edits the relay already accepts

1 participant