Skip to content

Make workshops commentable#1340

Open
maebeale wants to merge 1 commit intomainfrom
maebeale/workshop-comments
Open

Make workshops commentable#1340
maebeale wants to merge 1 commit intomainfrom
maebeale/workshop-comments

Conversation

@maebeale
Copy link
Collaborator

@maebeale maebeale commented Mar 4, 2026

What is the goal of this PR and why is this important?

  • Make workshops commentable following the same pattern as people, users, organizations, and event registrations
  • Fix several bugs in the shared comment fields partial

How did you approach the change?

  • Added polymorphic has_many :comments association and accepts_nested_attributes_for to Workshop model
  • Added workshop lookup to CommentsController#set_commentable
  • Nested comment routes under workshops
  • Added admin-only comments section to workshop edit form (only shown for persisted records), matching the people form pattern
  • Fixed created_by/updated_by not persisting on nested comment attributes by using assign_attributes + manual user assignment before save
  • Removed leftover debug "test" text from _comment_fields.html.erb
  • Changed unknown user fallback from "Unknown" text to "--" in a chip
  • Fixed two-user initials chips to split 50% width (w-1/2 text-center)
  • Wrapped images section in a collapsible toggle (expanded by default)
  • Added workshop polymorphic association test and :for_workshop factory trait

UI Testing Checklist

  • Edit a persisted workshop as admin — comments section appears
  • Add a comment — created_by is set to current user
  • Edit a comment — updated_by is set to current user, shows both initials chips
  • Comments with unknown authors show "--" chip
  • Images toggle collapses/expands correctly
  • Non-admin users do not see comments section

Anything else to add?

  • Dropdown toggle persistence (localStorage) was deferred to a separate PR

🤖 Generated with Claude Code

- Add polymorphic comments association to Workshop model
- Add nested comments to workshop edit form (admin-only, persisted records)
- Wire up comments controller, routes, and strong params for workshops
- Fix created_by/updated_by not persisting on nested comment attributes
- Remove debug "test" text from comment fields partial
- Show "--" chip fallback for unknown comment authors
- Fix two-user initials chips to split 50% width evenly
- Wrap images section in collapsible toggle (expanded by default)
- Add workshop polymorphic test and factory trait

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant