HOLD: Add related-comments overview + global comments index#1866
Draft
maebeale wants to merge 1 commit into
Draft
HOLD: Add related-comments overview + global comments index#1866maebeale wants to merge 1 commit into
maebeale wants to merge 1 commit into
Conversation
Comments live on five record types (people, orgs, users, workshops, registrations) but are only ever viewed one record at a time, so context that lives on a neighboring record (a registrant's person/org notes, an org's people) is easy to miss. This adds a single overview page reachable from every comment box that surfaces all related comments at once, plus a global index for previewing every comment and what it's about. - RelatedComments service derives the related set from the commentable's type (the type is the signal of which box the button was clicked from) - comments#index renders the full overview when scoped, a global "all comments" preview at /comments, and still the bare list for turbo frames - Shared "View all related comments" button added to every comment box Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
maebeale
commented
Jun 22, 2026
| .transform_values { |records| records.map(&:id).uniq } | ||
| end | ||
|
|
||
| def related_records |
Collaborator
Author
There was a problem hiding this comment.
🤖 From Claude: The commentable's type is the only signal of which comment box the button was clicked from — each box links to its own polymorphic *_comments_path — so this case statement is the single place that defines "related" per type. Add a when to extend it.
maebeale
commented
Jun 22, 2026
| # Scoped to a commentable: every comment related to that record (see | ||
| # RelatedComments). Top-level /comments: a preview of every comment in the | ||
| # system alongside the record each is about. | ||
| def index_comments |
Collaborator
Author
There was a problem hiding this comment.
🤖 From Claude: Three modes share this action: scoped related overview (full page), global /comments preview (no commentable), and the existing bare turbo-frame list for embeds/create — kept intact so the inline comment widgets don't change.
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.
What is the goal of this PR and why is this important?
HOLD:— opening for review/discussion of the "related" definitions per type before merge.How did you approach the change?
RelatedCommentsservice decides what "related" means per commentable type — the commentable type is the signal of which comment box the button was clicked from (each box links to its own polymorphic comments path), so one place owns the mapping:comments#indexnow serves three modes: scoped related overview (full page, styled like the allocations index, with an "About" column labeling each comment's record), a global/commentspreview of every comment, and the existing bare list for turbo-frame requests (embed/create flows untouched).View all related commentsbutton added to every comment box (people, orgs, workshops, users, registrations) via a single partial, opening the overview in a new tab.Affiliation.active; admin-only via the existingCommentPolicy.Anything else to add?
spec/services/related_comments_spec.rbcovers the per-type related set (incl. active-vs-inactive affiliation filtering);spec/requests/comments_spec.rbcovers the scoped overview, the global index, admin-restriction, and the turbo-frame path./comments(no nav entry yet — intentionally minimal).