Remove old Promoted group constants #24236
Merged
+257 −830
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#15957
Description
Removes the PromotedClass constants, that defined the properties of promoted groups.
Context
Most places that referenced the constants could be rewritten to use PROMOTED_GROUP_CHOICES instead, but that does mean if we eventually want to allow new promoted groups to be defined dynamically (i.e. delete PROMOTED_GROUP_CHOICES too), we're left with a lot of code that needs updating to make database queries instead. (search filters that rely only on publicly exposed classes would probably still use some constants).
On the other hand, if we're happy with constants defining the fixed list of groups available, along with their names and api_names, then we have duplicated data - we don't want the group name/api_name defined both in constants and in the database, ideally. (And that api_name is api_value in APIChoices is annoyingly different too)
I vendored in the old constants to make the old migration still work. Could have been removed instead, but then we'd kind of need fixtures that define the expected promoted groups instead.
Testing
Everything should really be covered by existing tests, but anything that might touch promoted groups could be manually tested. In particular (based on the code I had to touch):
badgedcan_primary_heroproperty)Checklist
#ISSUENUMat the top of your PR to an existing open issue in the mozilla/addons repository.