Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Allow adding, viewing information about and deleting soft-blocks in the admin #22765

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

diox
Copy link
Member

@diox diox commented Oct 14, 2024

Fixes mozilla/addons#15013

Description

Like other blocklist operations, everything goes through a BlocklistSubmission, which gains a new block_type field to determine what kind of block to apply for this particular submission. Users are not allowed to modify Blocks directly.

Note: If a version is already soft-blocked or hard-blocked, that version won't be selectable when creating a new BlocklistSubmission, even of another type. However, the code underneath should handle overriding the block type for a given blocked version in a submission, and future actions will be added to soften or harden blocks.

Testing

Play around with the admin and add/delete BlocklistSubmission, and then inspect the blocks until you're satisfied. Few things you can try to mix together:

  • Make soft or hard blocks
  • Make soft and hard blocks on add-ons with multiple versions (requires separate submissions)
  • BlocklistSubmission for add-ons with average_daily_users above settings.DUAL_SIGNOFF_AVERAGE_DAILY_USERS_THRESHOLD are subject to approval as before. You can check that it still behaves as expected. You shouldn't be able to modify a block type for a submission you're approving (arbitrary decision on my part, we could change this later)
  • Make soft and/or hard blocks for multiple guids at the same time, for add-ons containing multiple versions
  • Etc

…he admin

Like other blocklist operations, it goes through a BlocklistSubmission, which
gains a new "block_type" field to determine what kind of block to apply for
this particular submission.

Note: If a version is already soft-blocked or hard-blocked, that version won't
be selectable when creating a new BlocklistSubmission, even of another type.
Future actions will be added to soften or harden blocks.
@@ -407,7 +409,6 @@ def add_view(self, request, **kwargs):
'errors': admin.helpers.AdminErrorList(form, []),
'preserved_filters': self.get_preserved_filters(request),
# extra context we use in our custom template
'is_delete': is_delete,
Copy link
Member Author

Choose a reason for hiding this comment

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

Was not actually used (blocks.html widget has its own separate context)

@diox diox marked this pull request as ready for review October 15, 2024 12:17
@diox diox requested review from a team and KevinMind and removed request for a team October 15, 2024 12:24
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.

[Task]: Make it possible to add, view or delete soft-blocks in the admin
1 participant