addons-server icon indicating copy to clipboard operation
addons-server copied to clipboard

Write Promoted Information to New Models

Open chrstinalin opened this issue 9 months ago • 0 comments

Fixes: mozilla/addons#15476

Description

Changes promoted group information to be written directly to the new models rather than synced from PromotedAddon and PromotedApproval. This mainly includes:

  1. Changing PrimaryHero's promoted_addon OneToOneField to two ForeignKeys, addon and promoted_group. i. promoted_group allowsnull=True to represent the NOT_PROMOTED state. Its approval (i.e existing PromotedAddonPromotion of that addon and promoted_group) is implicitly checked via the approved_applications_for() call.
  2. Retired the PromotedAddonAdmin intoPromotedAddonPromotionAdmin and PrimaryHeroAdmin -- splintering PrimaryHeroInline off due to loss of direct FK.
  3. Refactoring to be creating PromotedAddonPromotions & PromotedAddonVersions.

Testing

PromotedAddonPromotion

  1. Create or delete a PromotedAddonPromotion for a group and application via the admin panel.
  2. Approve that group for the add-on (i.e create a PromotedAddonVersion).
  3. Behaviour associated with a promotion should work as expected (ex. the banner on Reviewer Tools, the badge on the landing page if recommended or line).

Ex. Deleting PromotedAddonPromotions: image image image And recreating one: image image image

PrimaryHero

  1. Create or modify a PrimaryHero through the primary hero admin page.
  2. PrimaryHero should be created or updated as expected, just as it behaved as an Inline.

Checklist

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

chrstinalin avatar Mar 24 '25 14:03 chrstinalin