Unverified Commit c7a3dd9d authored by Agate's avatar Agate 💬
Browse files

Fix #1011: Ensure tracks linked to skipped upload can be pruned

parent 8cd40699
......@@ -817,9 +817,15 @@ def get_prunable_tracks(
Returns a list of tracks with no associated uploads,
excluding the one that were listened/favorited/included in playlists.
purgeable_tracks_with_upload = (
queryset = models.Track.objects.all()
queryset = queryset.filter(uploads__isnull=True)
queryset = queryset.filter(
Q(uploads__isnull=True) | Q(pk__in=purgeable_tracks_with_upload)
if exclude_favorites:
queryset = queryset.filter(track_favorites__isnull=True)
if exclude_playlists:
......@@ -867,6 +867,8 @@ def test_clean_transcoding_cache(preferences, now, factories):
def test_get_prunable_tracks(factories):
prunable_track = factories["music.Track"]()
# track is still prunable if it has a skipped upload linked to it
factories["music.Upload"](import_status="skipped", track=prunable_track)
# non prunable tracks
Ensure tracks linked to skipped upload can be pruned (#1011)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment