kopia lustrzana https://dev.funkwhale.audio/funkwhale/funkwhale
Merge branch '302-private-playlist-show-in-interface' into 'develop'
Resolve "Private playlists not shown in interface" Closes #302 See merge request funkwhale/funkwhale!275environments/review-docs-256-t-yq4xet/deployments/18
commit
58be852a84
|
@ -17,13 +17,13 @@ def get_privacy_field():
|
|||
)
|
||||
|
||||
|
||||
def privacy_level_query(user, lookup_field="privacy_level"):
|
||||
def privacy_level_query(user, lookup_field="privacy_level", user_field="user"):
|
||||
if user.is_anonymous:
|
||||
return models.Q(**{lookup_field: "everyone"})
|
||||
|
||||
return models.Q(
|
||||
**{"{}__in".format(lookup_field): ["followers", "instance", "everyone"]}
|
||||
)
|
||||
**{"{}__in".format(lookup_field): ["instance", "everyone"]}
|
||||
) | models.Q(**{lookup_field: "me", user_field: user})
|
||||
|
||||
|
||||
class SearchFilter(django_filters.CharFilter):
|
||||
|
|
|
@ -110,7 +110,9 @@ class PlaylistTrackViewSet(
|
|||
def get_queryset(self):
|
||||
return self.queryset.filter(
|
||||
fields.privacy_level_query(
|
||||
self.request.user, lookup_field="playlist__privacy_level"
|
||||
self.request.user,
|
||||
lookup_field="playlist__privacy_level",
|
||||
user_field="playlist__user",
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -12,7 +12,8 @@ from funkwhale_api.users.factories import UserFactory
|
|||
(AnonymousUser(), Q(privacy_level="everyone")),
|
||||
(
|
||||
UserFactory.build(pk=1),
|
||||
Q(privacy_level__in=["followers", "instance", "everyone"]),
|
||||
Q(privacy_level__in=["instance", "everyone"])
|
||||
| Q(privacy_level="me", user=UserFactory.build(pk=1)),
|
||||
),
|
||||
],
|
||||
)
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Include user's current private playlists on playlist list (#302)
|
|
@ -71,6 +71,9 @@ export default {
|
|||
if (relativeUrl.startsWith('http')) {
|
||||
return relativeUrl
|
||||
}
|
||||
if (state.instanceUrl.endsWith('/') && relativeUrl.startsWith('/')) {
|
||||
relativeUrl = relativeUrl.slice(1)
|
||||
}
|
||||
return state.instanceUrl + relativeUrl
|
||||
}
|
||||
},
|
||||
|
|
|
@ -93,7 +93,7 @@ export default {
|
|||
let url = 'playlists/' + this.id + '/'
|
||||
axios.get(url).then((response) => {
|
||||
self.playlist = response.data
|
||||
axios.get(url + 'tracks').then((response) => {
|
||||
axios.get(url + 'tracks/').then((response) => {
|
||||
self.updatePlts(response.data.results)
|
||||
}).then(() => {
|
||||
self.isLoading = false
|
||||
|
|
Ładowanie…
Reference in New Issue