Clean up note reference when deleting a reply - #184
Merged
Conversation
Deleting a reply only removed its own triples, leaving the parent note still pointing at the now-deleted reply and orphaning any child replies. DELETE /replies/:id now detaches the reply from every note that references it, recursively deletes child replies, and returns 404 instead of crashing when the reply does not exist.
maboukerfa
force-pushed
the
fix/reply-delete-note-reference
branch
from
June 5, 2026 06:42
b22c893 to
dfb2499
Compare
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.
Problem
Deleting a reply (
DELETE /replies/:id) only removed the reply's own triples. This left:replylist (dangling reference), andparentpointing at a deleted reply).It also returned a 500 (
NoMethodErroronnil.delete) when the reply id didn't exist.Change
DELETE /replies/:idnow:Note
Note#savefiresLinkedData::Utils::Notifications.new_note(rescued), so detaching a reply triggers a "new note" notification, the same pre-existing quirk that already fires when a reply is added. Left as-is to keep this change focused; happy to suppress it on this path (delete just the<note> reply <reply>triple) in a follow-up if wanted.