Skip to content

AO3-6498 Allow certain admins to access refused gifts page#5593

Merged
Bilka2 merged 6 commits intootwcode:masterfrom
not-varram:AO3-6498-Allow-certain-admins-to-access-refused-gifts-page
Mar 21, 2026
Merged

AO3-6498 Allow certain admins to access refused gifts page#5593
Bilka2 merged 6 commits intootwcode:masterfrom
not-varram:AO3-6498-Allow-certain-admins-to-access-refused-gifts-page

Conversation

@not-varram
Copy link
Copy Markdown
Contributor

Pull Request Checklist

Issue

https://otwarchive.atlassian.net/browse/AO3-6498 (Please fill in issue number and remove this comment.)

Purpose

Fixes admin access on user gifts pages so policy_and_abuse and superadmin can:

  • see the Accepted/Refused gifts navigation,
  • load refused gifts via URL/tab,
  • while still not being shown recipient action buttons (Accept Gift / Refuse Gift)

Testing Instructions

  1. Log in as an admin with role policy_and_abuse or superadmin.
  2. Visit /users/:username/gifts for a user with at least one refused gift.
  3. Confirm tabs for Accepted Gifts and Refused Gifts are visible.
  4. Click Refused Gifts (or visit /users/:username/gifts?refused=true) and confirm refused gifts are shown.
  5. Confirm recipient action buttons are not shown to admin.
  6. (Negative check) Log in as another admin role (e.g., support) and confirm refused gifts tab/page is not available.

Credit

varram (he/him)

Copy link
Copy Markdown
Contributor

@Bilka2 Bilka2 left a comment

Choose a reason for hiding this comment

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

Please use pundit for the access control. You can find our existing policies in the app/policies folder if you'd like examples. The other issues on the admin role Epic also have examples of pundit implementations.

For the specs, please use the an action only authorized admins can access shared example if possible, it tests a lot of admin roles automatically and we don't need to duplicate that code here. Examples for it's use can be found all across the admin role tests.

Copy link
Copy Markdown
Contributor

@Bilka2 Bilka2 left a comment

Choose a reason for hiding this comment

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

Thanks for converting to pundit!

Comment thread app/controllers/gifts_controller.rb Outdated
Comment thread spec/controllers/gifts_controller_spec.rb Outdated
Comment thread app/controllers/gifts_controller.rb Outdated
Comment thread app/controllers/gifts_controller.rb Outdated
Comment thread app/controllers/gifts_controller.rb Outdated
Comment thread app/controllers/gifts_controller.rb Outdated
Comment thread app/controllers/gifts_controller.rb Outdated
Comment thread spec/controllers/gifts_controller_spec.rb Outdated
Comment thread spec/controllers/gifts_controller_spec.rb Outdated
Co-authored-by: Bilka <Bilka2@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@Bilka2 Bilka2 left a comment

Choose a reason for hiding this comment

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

Thank you!

@Bilka2 Bilka2 merged commit 5a46735 into otwcode:master Mar 21, 2026
29 checks passed
@not-varram not-varram deleted the AO3-6498-Allow-certain-admins-to-access-refused-gifts-page branch March 21, 2026 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants