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

Correct PromotedGroup Approvals #23218

Merged
merged 5 commits into from
Mar 25, 2025

Conversation

chrstinalin
Copy link
Contributor

@chrstinalin chrstinalin commented Mar 24, 2025

Fixes: mozilla/addons#15487

Description

Fixes the logic relating to retrieving approved promotions for an add-on.

Testing

Note: Expected promotions are in the promotedaddon admin.

  1. Run /manage.py sync_promoted_addons.
  2. All promotions in search view, when filtered by 'Recommended' or by 'For Firefox', are listed as expected.
  3. Recommended badges appear on the listing page for individual Recommended add-ons.
  4. 'For Firefox' badges appear on the listing page for individual Line add-ons.
  5. The reviewer tools page correctly shows any promotion on the banner.

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.

@chrstinalin chrstinalin marked this pull request as draft March 24, 2025 17:04
@chrstinalin chrstinalin force-pushed the #15487-correct-approval-logic branch from fb90f91 to 8bfac47 Compare March 24, 2025 18:32
@chrstinalin chrstinalin requested a review from KevinMind March 24, 2025 20:07
@chrstinalin chrstinalin marked this pull request as ready for review March 24, 2025 20:07
@chrstinalin chrstinalin requested a review from KevinMind March 24, 2025 21:02
@chrstinalin chrstinalin force-pushed the #15487-correct-approval-logic branch from 89bf69f to d4e160e Compare March 24, 2025 21:04
@@ -123,6 +123,7 @@ def bump_addon_version(old_version):
addon = old_version.addon
old_file_obj = old_version.file
promoted_group = addon.promoted_groups(currently_approved=True)
carryover = promoted_group and any(promoted_group.listed_pre_review)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a tangible benefit here? If not, just remove the diff.

Copy link
Contributor Author

@chrstinalin chrstinalin Mar 25, 2025

Choose a reason for hiding this comment

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

The code shortly after this makes changes to the current_version of the addon, which, given the lazy evaluation of querysets, affects the result of promoted_group (namely, it loses access to the promotion).

Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a test covering this? Seems not since you could change the code without any failure. Please add a test for that behavior.

@KevinMind KevinMind self-requested a review March 24, 2025 21:35
Copy link
Contributor

@KevinMind KevinMind left a comment

Choose a reason for hiding this comment

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

Basic verification is passing for me. I'd like some better test instructions

  • how to test for different types of badges
  • how to verify results
  • include before/after screenshots

Additionally I would like some more unit tests on the PromotedGroup model methods. Other than that looks good.

@chrstinalin chrstinalin force-pushed the #15487-correct-approval-logic branch from 5867f73 to 2d31c11 Compare March 25, 2025 15:39
@chrstinalin chrstinalin merged commit 5f7a700 into mozilla:master Mar 25, 2025
41 checks passed
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.

[Bug]: [DEV] "Recommended" and "By Firefox" badge does not appear on addon detail page
2 participants