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

Refactor promoted groups to use APIChoicesWithNone #23051

Merged
merged 3 commits into from
Feb 11, 2025

Conversation

KevinMind
Copy link
Contributor

@KevinMind KevinMind commented Feb 4, 2025

fixes: mozilla/addons#15335

Description

  • Replacing hardcoded promoted group constants with an APIChoicesWithNone implementation
  • Updating references across multiple files to use the new PROMOTED_GROUP_CHOICES
  • Ensuring consistent group ID references and API-related attributes
  • Simplifying imports and reducing redundant constant definitions

Context

This is a step to simplifying the PromotedAddon data model by isolating the PromotedClass instances. If we don't import them all over the code base we can more easily make changes to the data model without breaking things.

Testing

CI should pass, no changes to any logic, just string/number references.

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.

@KevinMind KevinMind force-pushed the kevinmind/addons/14986-add-promoted-group-model branch 8 times, most recently from 981884d to a9c3e9b Compare February 4, 2025 18:34
@KevinMind KevinMind marked this pull request as draft February 4, 2025 18:42
@KevinMind KevinMind force-pushed the kevinmind/addons/14986-add-promoted-group-model branch 2 times, most recently from 8a251ab to 3c7abc4 Compare February 4, 2025 18:56
@KevinMind KevinMind force-pushed the kevinmind/addons/14986-add-promoted-group-model branch 2 times, most recently from 9052755 to 2358f05 Compare February 5, 2025 16:55
- Replacing hardcoded promoted group constants with an APIChoicesWithNone implementation
- Updating references across multiple files to use the new PROMOTED_GROUP_CHOICES
- Ensuring consistent group ID references and API-related attributes
- Simplifying imports and reducing redundant constant definitions

The changes improve type safety, make the code more maintainable, and provide a more flexible approach to managing promoted addon groups.
@KevinMind KevinMind force-pushed the kevinmind/addons/14986-add-promoted-group-model branch from 2358f05 to b350cd3 Compare February 6, 2025 12:00
@KevinMind KevinMind requested a review from chrstinalin February 7, 2025 10:10
@KevinMind KevinMind marked this pull request as ready for review February 7, 2025 10:10
@KevinMind KevinMind changed the title Add PromotedGroup model to replace legacy PromotedClass Refactor promoted groups to use APIChoicesWithNone Feb 7, 2025
@chrstinalin chrstinalin self-requested a review February 7, 2025 15:29
@KevinMind KevinMind requested a review from chrstinalin February 7, 2025 17:34
@KevinMind KevinMind merged commit 13d6bfc into master Feb 11, 2025
41 checks passed
@KevinMind KevinMind deleted the kevinmind/addons/14986-add-promoted-group-model branch February 11, 2025 08:31
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]: Refactor explicit reference to PromotedClass to use a django choice class
2 participants