Closed eviljeff closed 7 years ago
Added a gigantic list of files to check.
Random notes from IRC discussion with @eviljeff :
STATUS_NULL
status, most of the public-facing code should be relatively safe..objects
to with_unlisted
as we go along and fix code, and when everything is switched to with_unlisted
, remove the filtering from objects
manager and switch the code back to using .objects
.All usage of Addon.objects
should have been fixed now, so we can start working on changing the managers. I'll do that.
Addon.objects contains all listed, not deleted, add-ons (filter on .is_listed); Addon.with_unlisted contains both listed and unlisted (not deleted) add-ons. With mixed listed/unlisted versions Addon.objects will contain add-ons that contain unlisted versions; Addon.with_unlisted will be obsolete.
Tasks:
src/olympia/users/views.py
Addon.objects.valid
andAddon.objects.none()
, both should be fine.src/olympia/users/models.py
CollectionAddon.objects
.src/olympia/legacy_api/views.py
src/olympia/addons/forms.py
src/olympia/addons/management/commands/process_addons.py
--with-unlisted
parameter.src/olympia/addons/utils.py
reverse_name_lookup
need to be patched, which may be non-trivial.reverse_name_lookup
is gone.get_featured_ids
andget_creatured_ids
should filter onstatus
.src/olympia/addons/cron.py
_change_last_updated
is weird, should be looked at, but it makes sense that it'd affect unlisted add-onsupdate_addon_appsupport
deliver_hotness
should probably filter onstatus
..get(pk={something})
and should be fine.src/olympia/addons/views.py
home
is using.listed()
which is already filtering onstatus
. It's also usingfeatured
, which isn't, but it's less important since it's editorial stuff. Filtering on status there shouldn't hurt either, though. Need to be careful as there is a secondhome
view for mobile.persona_detail
is fine since it's Personas and it's using.public()
AddonFeaturedView
is using.valid()
which filters on status already. Maybe it should use something more restrictive like.public()
though.addon_view_factory()
+ some querysets that should already filter things out correctly depending onstatus
.src/olympia/addons/models.py
cron.py
above,_last_updated_queries()
could be updated but at the same time it might make sense for it to affect unlisted add-ons.id
/guid
.src/olympia/addons/tasks.py
src/olympia/addons/decorators.py
addon_view
decorator has a defaultqs
argumentAddon.objects.all
but it's never used directly, views always useaddon_view_factory
and always pass a queryset.src/olympia/reviews/views.py
status
or just getting some add-ons by their id.src/olympia/reviews/feeds.py
src/olympia/reviews/tasks.py
addon_bayesian_rating
does some aggregating over the whole db which sounds suspicious, probably need to filter onstatus
.src/olympia/devhub/forms.py
.reviewed()
.src/olympia/devhub/tasks.py
src/olympia/bandwagon/views.py
src/olympia/bandwagon/models.py
CollectionAddon
.src/olympia/bandwagon/feeds.py
.valid()
.src/olympia/bandwagon/tasks.py
CollectionAddon
.src/olympia/landfill/collection.py
CollectionAddon.objects
.src/olympia/landfill/generators.py
Addon.objects.create
src/olympia/versions/views.py
Addon.objects.valid
which filters on status already.src/olympia/versions/feeds.py
.valid()
.src/olympia/zadmin/views.py
Addon.objects
to fetch langpacks and filtering onaddonuser__user__email=settings.LANGPACK_OWNER_EMAIL
, so that's OK.status__in=amo.VALID_ADDON_STATUSES
which is OK as well.ValidationResultAffectedAddon.objects
is a false positiveaddon_search()
gets the object by id or uses ES - in any case it should be fine for it to return unlisted add-ons, it's an admin tool.src/olympia/zadmin/models.py
ValidationResultAffectedAddon.objects
src/olympia/zadmin/tasks.py
add_validation_jobs()
is filtering on specific pks.notify_compatibility()
is... a mess. Need to revisit this later, but it does not expect unlisted add-ons so it might break.src/olympia/stats/management/commands/theme_update_counts_from_file.py
status
as well.src/olympia/stats/management/commands/update_counts_from_file.py
_current_version
existence, if notstatus
.src/olympia/stats/management/commands/download_counts_from_file.py
_current_version
existence, and/orstatus
like the previous one.src/olympia/stats/cron.py
This cron is not called anywhere, removing it.addon_total_contributions()
is going through all the add-ons in chunks to update their total number of contributions. Should probably filter on_current_version
or/andstatus
, or be much smarter and filter on the list of add-ons which had contributions since the last time the cron was run...src/olympia/stats/tasks.py
addon_total_contributions()
is filtering on id_get_daily_jobs
computes the number of new add-ons (addon_count_new
) withAddon.objects
. We may want to keep it as-is to include purely unlisted add-ons, or filter on_current_version
.status
already.src/olympia/editors/views.py
Addon.objects
in `queue_version_notes() to get an add-on by its id.src/olympia/editors/helpers.py
get_position()
filters onstatus
already.src/olympia/editors/views_themes.py
status
andtype=amo.ADDON_PERSONA
src/olympia/legacy_discovery/views.py
Addon.objects.valid
.src/olympia/legacy_discovery/modules.py
Addon.objects.in_bulk()
with specific ids.src/olympia/browse/views.py
addon_listing()
filters with.public()
or through.listed()
+amo.REVIEWED_STATUSES
.language_tools()
,creatured()
andpersonas_listing()
filter with.public()
.category_landing()
filters with.listed()
(and thereforeamo.STATUS_PUBLIC
)SearchToolsFilter
filters with.valid()
search_tools()
filters with.listed()
, passingamo.STATUS_PUBLIC
explicitly.src/olympia/browse/feeds.py
Addon.objects.featured()
.Like mentioned above it's not a deal breaker because it's editorial stuff but we should add filtering ondone.status
inget_featured_ids()
.src/olympia/discovery/views.py
Addon.objects.public()
.src/olympia/search/views.py
Addon.objects.none()
andAddon.objects.reviewed()
.src/olympia/compat/cron.py