From 133e2e4f07214df9364f0002571fd2557645e86a Mon Sep 17 00:00:00 2001 From: Eliot Berriot <contact@eliotberriot.com> Date: Wed, 1 Apr 2020 16:21:41 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20#1059:=20fixed=20some=20broken=20RSS?= =?UTF-8?q?=C2=A0feeds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/funkwhale_api/music/filters.py | 8 ++++++-- api/funkwhale_api/music/utils.py | 1 + front/src/views/channels/DetailEpisodes.vue | 2 +- front/src/views/channels/DetailOverview.vue | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/api/funkwhale_api/music/filters.py b/api/funkwhale_api/music/filters.py index ca22467cb7..feae9b81ca 100644 --- a/api/funkwhale_api/music/filters.py +++ b/api/funkwhale_api/music/filters.py @@ -29,7 +29,11 @@ class ChannelFilterSet(filters.FilterSet): if not value: return queryset - channel = audio_models.Channel.objects.filter(uuid=value).first() + channel = ( + audio_models.Channel.objects.filter(uuid=value) + .select_related("library") + .first() + ) if not channel: return queryset.none() @@ -38,7 +42,7 @@ class ChannelFilterSet(filters.FilterSet): actor = utils.get_actor_from_request(self.request) uploads = uploads.playable_by(actor) ids = uploads.values_list(self.Meta.channel_filter_field, flat=True) - return queryset.filter(pk__in=ids) + return queryset.filter(pk__in=ids).distinct() class LibraryFilterSet(filters.FilterSet): diff --git a/api/funkwhale_api/music/utils.py b/api/funkwhale_api/music/utils.py index 599e4ae4d2..14f245aaa4 100644 --- a/api/funkwhale_api/music/utils.py +++ b/api/funkwhale_api/music/utils.py @@ -38,6 +38,7 @@ def compute_status(jobs): AUDIO_EXTENSIONS_AND_MIMETYPE = [ # keep the most correct mimetype for each extension at the bottom + ("mp3", "audio/mp3"), ("mp3", "audio/mpeg3"), ("mp3", "audio/x-mp3"), ("mp3", "audio/mpeg"), diff --git a/front/src/views/channels/DetailEpisodes.vue b/front/src/views/channels/DetailEpisodes.vue index ab5920eb46..7535d7edf6 100644 --- a/front/src/views/channels/DetailEpisodes.vue +++ b/front/src/views/channels/DetailEpisodes.vue @@ -1,6 +1,6 @@ <template> <section> - <channel-entries :limit="25" :filters="{channel: object.uuid, ordering: '-creation_date', playable: 'true'}"> + <channel-entries :limit="25" :filters="{channel: object.uuid, ordering: '-creation_date'}"> </channel-entries> </section> </template> diff --git a/front/src/views/channels/DetailOverview.vue b/front/src/views/channels/DetailOverview.vue index 9d35b1d175..8a739028af 100644 --- a/front/src/views/channels/DetailOverview.vue +++ b/front/src/views/channels/DetailOverview.vue @@ -49,7 +49,7 @@ :can-update="false"></rendered-description> <div class="ui hidden divider"></div> </div> - <channel-entries :key="String(episodesKey) + 'entries'" :filters="{channel: object.uuid, ordering: '-creation_date', playable: 'true'}"> + <channel-entries :key="String(episodesKey) + 'entries'" :filters="{channel: object.uuid, ordering: '-creation_date'}"> <h2 class="ui header"> <translate translate-context="Content/Channel/Paragraph">Latest episodes</translate> </h2> -- GitLab