Handle deleted comment thread subjects - #2453
Merged
Merged
Conversation
Move the EntryStateProvider and collection watching from EntryCommentsView up into the shared ReviewView base, so every review sidebar panel can resolve entry structure — such as the section a comment subject lives in — not just the comments list. REDMINE-21261
Add a section_perma_id column to comment threads and carry it through the review API. This lets a thread record the section its subject belongs to, so later changes can keep a comment in context when its content element is deleted. REDMINE-21261
Persist the perma id of a comment subject's section when creating a thread, and place threads by their subject while relocating a thread whose content element was deleted to that section — so the comment stays visible in context. Threads whose section is also gone fall back to the top-level orphans. REDMINE-21261
When a content element batch persists, set the section perma id of the threads on that section's elements. A thread whose element was moved here from another section then relocates to the correct section once the element is deleted. REDMINE-21261
After a content element batch saves, mirror the server-side section reconcile into the in-memory ReviewSession so threads on the section's content elements carry the right sectionPermaId. A moved thread then stays relocatable to the correct section even if its content element is deleted in the same session. REDMINE-21261
Compute the entry-structure × threads join once in a LocatedCommentThreadsProvider and share it; useLocatedCommentThreads reads the context. Wire the provider into the editor ReviewView and the commenting and inline-editing entry decorators. Fold orphaned threads (whose content element was deleted) into their section's list in final display order, flagged with `orphaned` and leading the section; orphans whose section is also gone lead the first section so they stay reachable. Expose a bySubject index and include orphans in the flat list and chapter counts. REDMINE-21261
Reads a subject's threads from the shared LocatedCommentThreadsProvider — for a section including the orphaned threads folded into it — and filters by resolution and range. Replaces useSectionCommentThreads: review components can read threads by subject (with orphans) from the context map instead of re-scanning review state, keeping resolution/range filtering out of the components. Export matchesResolution for it. REDMINE-21261
A thread whose content element was deleted stays in context under its section but reads as a reply to nothing. Render a hint above the first comment noting it refers to a deleted element, driven by the thread's `orphaned` flag set during placement. REDMINE-21261
Instead of receiving threads as props, ThreadList and ThreadsBadge read their subject's threads from the LocatedCommentThreadsProvider via useLocatedCommentThreadsForSubject. The located threads already include a section's orphans (folded in, flagged, on top) and are ordered and range-sorted there, so the components keep no resolution filtering or sorting — ThreadList just splits resolved from active and Thread renders the deleted-element hint from the flag. Callers revert to passing the subject: Popover, the commenting and inline-editing decorators, and the EntryCommentsView/SelectionCommentsView thread lists. REDMINE-21261
A section's list holds the orphaned threads of its deleted content elements, so the navigator now offers them as targets that step to the section (an orphan's own subject no longer exists in the preview) and the toolbar counts them. The section popover opens with the orphan highlighted. REDMINE-21261
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.
REDMINE-21261