mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-03 19:39:18 +02:00
Resolve "Hide an artist in the UI"
This commit is contained in:
parent
d4d4e60e39
commit
bdf83bd8ff
50 changed files with 1051 additions and 49 deletions
|
@ -117,9 +117,21 @@ class PlaylistSerializer(serializers.ModelSerializer):
|
|||
except AttributeError:
|
||||
return []
|
||||
|
||||
try:
|
||||
user = self.context["request"].user
|
||||
except (KeyError, AttributeError):
|
||||
excluded_artists = []
|
||||
user = None
|
||||
if user and user.is_authenticated:
|
||||
excluded_artists = list(
|
||||
user.content_filters.values_list("target_artist", flat=True)
|
||||
)
|
||||
|
||||
covers = []
|
||||
max_covers = 5
|
||||
for plt in plts:
|
||||
if plt.track.album.artist_id in excluded_artists:
|
||||
continue
|
||||
url = plt.track.album.cover.crop["200x200"].url
|
||||
if url in covers:
|
||||
continue
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue