fix(desktop): fold kind 40003 edit content into forum posts and comments - #6605
Open
BradGroux wants to merge 1 commit into
Open
fix(desktop): fold kind 40003 edit content into forum posts and comments#6605BradGroux wants to merge 1 commit into
BradGroux wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 existinglink_preview_suppression_targetspath). Applied in bothget_forum_postsandget_forum_threadso 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 highercreated_atwins.fold_edit_content_ignores_edit_targeting_different_event— edit with anetag 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_onlytest is unchanged. Cannot run the fullcargo testsuite from this host (no Rust toolchain). The build and test gate will be verified on CI.