Show matched restriction instances on review page - #25423
Open
jasonBirchall wants to merge 1 commit into
Open
Conversation
The DISABLE_AUTO_APPROVAL entry in the important-changes history now names the restriction classs in its comment. This change introduces a link to the specific page in django admin for users with Admin:Advanced. Those without will just see the plain text message.
jasonBirchall
requested review from
a team,
chrstinalin,
diox and
nothingrandom
and removed request for
a team,
diox and
nothingrandom
September 10, 2026 14:22
chrstinalin
approved these changes
Sep 11, 2026
| {% for history_id in record.details.restriction_history_ids %} | ||
| {% set entry = restriction_history_by_id.get(history_id) %} | ||
| {% if entry %} | ||
| <li class="light history-comment"> |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes mozilla/addons#16408
Description
What this change does:
DISABLE_AUTO_APPROVALentry in the review page's important-changes history now lists the specific restriction instance(s) that matched, resolved from theUserRestrictionHistoryrows recorded at submission time (via therestriction_history_idsthe entry already carries).Admin:Advanced, plain text for everyone else.What it looks like:
The entry in "Add-on important changes history" gains a list under the existing comment, one line per matched restriction.
A reviewer with
Admin:Advancedsees each value as a link to thatrestriction's admin page:
Why this shape:
AddonReviewerFlags. The flag is add-on-level and has non-restriction causes (Mozilla-signed packages), so it can't say which restriction fired.Admin:Advancedbecause that's theexact permission gating the restriction admin pages. Nobody gets a link they can't follow, and reviewers without it still see the value.
reasonfield is deliberately not shown. It's documented as a private description.Context
Completes the third acceptance criterion of #16408 (the DB and Redash queryability landed in #25344; this is the reviewer-facing exposure agreed as a follow-up).
Testing
Six tests in
TestReview: the admin link href and value for anAdmin:Advanceduser; value-without-link for a regular reviewer; twomatched restrictions rendering two links; a deleted restriction
rendering "since removed" with no link; a structural NULL-instance row rendering its message; and the existing comment-rendering test unchanged. Full
reviewers/tests/test_views.pypasses.Checklist
#ISSUENUMat the top of your PR to an existing open issue in the mozilla/addons repository.