Achievements: Add global opt-out of achievements

Part of the agreed Engineering Implementation Tasks from the February 2026 GA roadmap:

An explicit opt-out of Achievements should be implemented to stop awards from happening, which allows enterprise user controls.

What

Repurpose the existing user_preferences.achievements_enabled column. No new DB column or migration needed.

  • Change its meaning from "display achievements on your profile" to "allow others to award me achievements"
  • Achievements::AwardService (app/services/achievements/award_service.rb): add a guard before creating a UserAchievement record. If recipient.achievements_enabled == false, return an error. Currently the service only checks the awarding user's permission; the recipient's preference is never consulted.
  • Profile settings UI (app/views/user_settings/profiles/show.html.haml:174): update the checkbox label from "Display achievements on your profile" to "Allow others to award me achievements" (or agreed wording)
  • Profile sidebar (app/views/users/_profile_sidebar.html.haml:25): the achievements component is currently gated on achievements_enabled. After the repurpose, this gate should be removed or replaced. Display should rely solely on whether any UserAchievement records with show_on_profile: true exist for that user.

Notes

  • No DB migration required: user_preferences.achievements_enabled already exists (default true), delegated to User via user_preference
  • Distinct from show_on_profile: that controls visibility of already-awarded badges per achievement; this prevents new awards entirely
Edited by Mattias Michaux