Add setting to accept awarded achievements for recipients

What does this MR do and why?

Achievements require the recipient to accept them from a link in a notification email before they show on their profile. On self-managed instances without SMTP configured, that email never arrives, so awarded achievements stay permanently hidden: there is no UI to accept them and no plain URL to visit, because the accept link uses a signed ID. Today, admins work around this by generating accept links one at a time from the Rails console.

This MR adds an instance-level application setting, auto_accept_awarded_achievements (boolean, default false, stored in the existing default_profile_preferences JSONB column on application_settings), that lets admins skip the accept step for future awards.

When the setting is on:

  • Achievements::AwardService creates the UserAchievement with show_on_profile: true, so a newly awarded achievement appears on the recipient's profile immediately.
  • The new-achievement notification email omits the acceptance link and the "if you do not wish to accept, simply ignore this email" line, since there is nothing left to accept.

The setting has two deliberate limits, agreed during review on the linked work item:

  • It only applies at award time. Achievements awarded before the setting was turned on are untouched, including ones still waiting for acceptance.
  • It does not override the recipient's own choice. Recipients can still hide any achievement with the userAchievementsUpdate GraphQL mutation, exactly as before. An earlier revision of this MR made the setting win over the stored show_on_profile value and blocked recipients from hiding their achievements; that was rejected in review (see Taucher2003's comment on the work item) and has been removed.

The setting is admin-only and is not exposed to users. It appears in Admin > Settings > General > Account and limit, in the User restrictions section, as a checkbox labelled Automatically accept achievements for all users. Wording was agreed with Product (sayobittencourt) and Technical Writing/UX (idurham) on the work item. It is also exposed through the application settings REST API (PUT /api/v4/application/settings).

Documentation updated in:

  • doc/administration/settings/account_and_limit_settings.md (new section "Automatically accept achievements for all users")
  • doc/user/profile/achievements.md
  • doc/api/settings.md

Changelog: added Signed-off-by: BoxBoxJason contact@boxboxjason.dev

References

Closes #607750 (closed)

The final scope of this MR, including the two limits above, was agreed in the discussion on that work item.

Screenshots or screen recordings

image

How to set up and validate locally

  1. Turn on the setting: either check Automatically accept achievements for all users under Admin > Settings > General > Account and limit > User restrictions, or call the API:
    curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" \
      "http://127.0.0.1:3000/api/v4/application/settings?auto_accept_awarded_achievements=true"
  2. Award an achievement to a user with the achievementsAward GraphQL mutation.
  3. Confirm the achievement shows on the recipient's profile immediately, and that the notification email sent to the recipient contains no accept link.
  4. Confirm the recipient can still hide the achievement with the userAchievementsUpdate GraphQL mutation.
  5. Turn the setting off and award a new achievement. Confirm it does not show on the recipient's profile until they accept it.
Edited by BoxBoxJason

Merge request reports

Loading
Loading