Skip to content

fix(tc): handle unauthenticated and already-accepted users#2582

Merged
olleolleolle merged 3 commits intocodebar:masterfrom
mroderick:fix/tc-unauthenticated-handling
Apr 22, 2026
Merged

fix(tc): handle unauthenticated and already-accepted users#2582
olleolleolle merged 3 commits intocodebar:masterfrom
mroderick:fix/tc-unauthenticated-handling

Conversation

@mroderick
Copy link
Copy Markdown
Collaborator

@mroderick mroderick commented Apr 22, 2026

Summary

Two bug fixes for the Terms and Conditions page:

Bug: Unauthenticated users crash when submitting form

  • Problem: Unauthenticated users could visit /terms_and_conditions and click "Accept", which would crash because current_user is nil
  • Fix: Controller checks login status and redirects to GitHub OAuth if not logged in
  • Commits: b28f8eb

Bug: Users who already accepted T&C see the form again

  • Problem: Logged-in users who have already accepted T&C would see the acceptance form again
  • Fix: Shows a message "You have already accepted our Code of Conduct on [date]." instead of the form
  • Commits: b56caa4

Changes

  • app/controllers/terms_and_conditions_controller.rb - add login check
  • app/views/terms_and_conditions/show.html.haml - conditional display for different states
  • config/locales/en.yml - new locale strings
  • spec/features/accepting_terms_and_conditions_spec.rb - new tests

Testing

  • All tests pass (7/8, 1 pre-existing Playwright setup issue unrelated to this change)

@mroderick mroderick force-pushed the fix/tc-unauthenticated-handling branch 2 times, most recently from 6f724d0 to 5295f5a Compare April 22, 2026 06:30
@mroderick mroderick force-pushed the fix/tc-unauthenticated-handling branch from 5295f5a to 20fa3c3 Compare April 22, 2026 06:37
@mroderick mroderick marked this pull request as ready for review April 22, 2026 06:39
Comment thread spec/features/accepting_terms_and_conditions_spec.rb Outdated
Copy link
Copy Markdown
Collaborator

@olleolleolle olleolleolle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to have!

I made a note on code formatting.

@mroderick mroderick force-pushed the fix/tc-unauthenticated-handling branch from f556d78 to 7be548f Compare April 22, 2026 07:19
@olleolleolle olleolleolle merged commit 73b5fc1 into codebar:master Apr 22, 2026
8 checks passed
@mroderick mroderick deleted the fix/tc-unauthenticated-handling branch April 23, 2026 14:04
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.

2 participants