Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add ability to harden / soften blocks in the admin #22827

Merged
merged 6 commits into from
Nov 13, 2024

Conversation

diox
Copy link
Member

@diox diox commented Nov 6, 2024

Fixes: mozilla/addons#15084

Description

See title, this allows admins to harden or soften a block (either partially or completely).

Context

Like with the rest of the block operations, you're never directly modifying Block or BlockVersion for this in the admin, instead you go through a BlocklistSubmission with a specific action. This allows signoff and makes the UI consistent across the various blocklist-related features in the admin.

Testing

There should be harden & soften buttons for a block. Once on the corresponding page, you should be able to select only the hard-blocked versions in that block for the soften action, and the opposite, soft-blocked versions for the harden action. Once you submit, the selected versions should have their block type changed according to the action performed.

The signoff mechanism is reused, untouched. So, if the change requires signoff (average daily users for the add-on is above configured threshold of settings.DUAL_SIGNOFF_AVERAGE_DAILY_USERS_THRESHOLD), the changes are pending approval, which is performed as normal in the same admin (in production it would be a different user, if DEBUG is True we allow the same user)

Checklist

  • Add #ISSUENUM at the top of your PR to an existing open issue in the mozilla/addons repository.
  • Successfully verified the change locally.
  • The change is covered by automated tests, or otherwise indicated why doing so is unnecessary/impossible.
  • Add before and after screenshots (Only for changes that impact the UI).
  • Add or update relevant docs reflecting the changes made.

src/olympia/blocklist/admin.py Outdated Show resolved Hide resolved
@diox diox force-pushed the blockadmin-harden-soften-actions branch from f7bca99 to e97d832 Compare November 8, 2024 15:48
@diox diox force-pushed the blockadmin-harden-soften-actions branch from e97d832 to ac544c6 Compare November 8, 2024 15:54
@diox
Copy link
Member Author

diox commented Nov 8, 2024

Screenshots

Slight copy changes on Delete Block page (call the action next to the blocked version "Unblock")

Screenshot 2024-11-08 at 17-45-27 Delete Block Django site admin

Hardening a complex block

Note that only the soft-blocked version is available to select
Screenshot 2024-11-08 at 17-45-10 Harden Block Django site admin

Softening a complex block

Opposite as before
Screenshot 2024-11-08 at 17-48-15 Soften Block Django site admin

Soften / Harden buttons shown on Block page

Both buttons available
Screenshot 2024-11-08 at 17-49-08 Block {105ca783-0522-4143-b8ed-062cba7028a9} View block Django site admin
Only Softening button available
Screenshot 2024-11-08 at 17-44-46 Block {ff560d64-a5f6-4027-92c7-2185a959bb61} View block Django site admin
Only Hardening button available
Screenshot 2024-11-08 at 17-44-36 Block {8598fe93-e71a-429a-9557-5bbb8c3e53dd} View block Django site admin

@diox diox requested a review from eviljeff November 8, 2024 16:59
@diox diox marked this pull request as ready for review November 8, 2024 16:59
Copy link
Member

@eviljeff eviljeff left a comment

Choose a reason for hiding this comment

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

Just nits

src/olympia/blocklist/models.py Outdated Show resolved Hide resolved
src/olympia/blocklist/forms.py Outdated Show resolved Hide resolved
@diox
Copy link
Member Author

diox commented Nov 12, 2024

@eviljeff went ahead and used extended choices in c59d742 ; re-requesting approval because it's a large change (as you said, marginal benefits, but it does address the couple minor points you raised, so I figured it was worth a try and could be useful in the long run)

@diox diox requested a review from eviljeff November 12, 2024 12:04
Copy link
Member

@eviljeff eviljeff left a comment

Choose a reason for hiding this comment

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

:shipit:

@diox diox merged commit 2a1eb8b into mozilla:master Nov 13, 2024
31 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task]: Implement soften and harden block actions in the admin
2 participants