Skip to content

feat(comment): add guest/anonymous comments support - #1

Open
capy-ai[bot] wants to merge 1 commit into
masterfrom
capy/guest-comments-support
Open

capy-ai[bot] wants to merge 1 commit into
masterfrom
capy/guest-comments-support

Conversation

@capy-ai

@capy-ai capy-ai Bot commented Apr 2, 2026

Copy link
Copy Markdown

This PR adds support for guest/anonymous comments by introducing guest_name and guest_email columns to the comments table, updating the Comment model with conditional validations and helper methods, and providing both new and upgrade migration paths.

  • Updated migration templates at lib/generators/acts_as_commentable_with_threading_migration/templates/migration.rb and lib/generators/acts_as_commentable_upgrade_migration/templates/migration.rb to add guest_name and guest_email columns, and make user_id nullable
  • Modified Comment model templates in both generators to validate either user or guest_name, validate guest email format, and add commenter_name, guest_comment?, and user_required? helper methods
  • Extended Comment.build_from to accept optional guest_name and guest_email while maintaining backward compatibility with the existing user_id parameter
  • Added new generator lib/generators/acts_as_commentable_guest_migration for upgrading existing installations to support guest comments
  • Updated test schema at spec/db/schema.rb and added guest comment tests at spec/comment_spec.rb
  • Documented guest comment usage in README.md

Guest comments require a guest_name when no user is present, email is optional but validated when provided, and commenter_name returns user.name, guest_name, or "Anonymous".

Open in Capy SCO-1 · 5.4

@capy-ai capy-ai Bot added the capy Generated by capy.ai label Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

capy Generated by capy.ai

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant