Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
funkwhale
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Arthur Brugière
funkwhale
Commits
0176b29d
Verified
Commit
0176b29d
authored
4 years ago
by
Ciarán Ainsworth
Committed by
Georg Krause
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add missing playable serializer
parent
e67faee3
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
api/funkwhale_api/music/serializers.py
+4
-1
4 additions, 1 deletion
api/funkwhale_api/music/serializers.py
api/tests/music/test_serializers.py
+1
-0
1 addition, 0 deletions
api/tests/music/test_serializers.py
changes/changelog.d/playable.bugfix
+1
-0
1 addition, 0 deletions
changes/changelog.d/playable.bugfix
with
6 additions
and
1 deletion
api/funkwhale_api/music/serializers.py
+
4
−
1
View file @
0176b29d
...
@@ -201,7 +201,6 @@ class AlbumSerializer(OptionalDescriptionMixin, serializers.Serializer):
...
@@ -201,7 +201,6 @@ class AlbumSerializer(OptionalDescriptionMixin, serializers.Serializer):
release_date
=
serializers
.
DateField
()
release_date
=
serializers
.
DateField
()
creation_date
=
serializers
.
DateTimeField
()
creation_date
=
serializers
.
DateTimeField
()
is_local
=
serializers
.
BooleanField
()
is_local
=
serializers
.
BooleanField
()
is_playable
=
serializers
.
SerializerMethodField
()
get_attributed_to
=
serialize_attributed_to
get_attributed_to
=
serialize_attributed_to
...
@@ -302,6 +301,7 @@ class TrackSerializer(OptionalDescriptionMixin, serializers.Serializer):
...
@@ -302,6 +301,7 @@ class TrackSerializer(OptionalDescriptionMixin, serializers.Serializer):
license
=
serializers
.
SerializerMethodField
()
license
=
serializers
.
SerializerMethodField
()
cover
=
cover_field
cover
=
cover_field
get_attributed_to
=
serialize_attributed_to
get_attributed_to
=
serialize_attributed_to
is_playable
=
serializers
.
SerializerMethodField
()
def
get_artist
(
self
,
o
):
def
get_artist
(
self
,
o
):
return
serialize_artist_simple
(
o
.
artist
)
return
serialize_artist_simple
(
o
.
artist
)
...
@@ -323,6 +323,9 @@ class TrackSerializer(OptionalDescriptionMixin, serializers.Serializer):
...
@@ -323,6 +323,9 @@ class TrackSerializer(OptionalDescriptionMixin, serializers.Serializer):
def
get_license
(
self
,
o
):
def
get_license
(
self
,
o
):
return
o
.
license_id
return
o
.
license_id
def
get_is_playable
(
self
,
obj
):
return
bool
(
getattr
(
obj
,
"
playable_uploads
"
,
[]))
@common_serializers.track_fields_for_update
(
"
name
"
,
"
description
"
,
"
privacy_level
"
)
@common_serializers.track_fields_for_update
(
"
name
"
,
"
description
"
,
"
privacy_level
"
)
class
LibraryForOwnerSerializer
(
serializers
.
ModelSerializer
):
class
LibraryForOwnerSerializer
(
serializers
.
ModelSerializer
):
...
...
This diff is collapsed.
Click to expand it.
api/tests/music/test_serializers.py
+
1
−
0
View file @
0176b29d
...
@@ -255,6 +255,7 @@ def test_track_serializer(factories, to_api_date):
...
@@ -255,6 +255,7 @@ def test_track_serializer(factories, to_api_date):
"
attributed_to
"
:
federation_serializers
.
APIActorSerializer
(
actor
).
data
,
"
attributed_to
"
:
federation_serializers
.
APIActorSerializer
(
actor
).
data
,
"
cover
"
:
common_serializers
.
AttachmentSerializer
(
track
.
attachment_cover
).
data
,
"
cover
"
:
common_serializers
.
AttachmentSerializer
(
track
.
attachment_cover
).
data
,
"
downloads_count
"
:
track
.
downloads_count
,
"
downloads_count
"
:
track
.
downloads_count
,
"
is_playable
"
:
bool
(
track
.
playable_uploads
),
}
}
serializer
=
serializers
.
TrackSerializer
(
track
)
serializer
=
serializers
.
TrackSerializer
(
track
)
assert
serializer
.
data
==
expected
assert
serializer
.
data
==
expected
...
...
This diff is collapsed.
Click to expand it.
changes/changelog.d/playable.bugfix
0 → 100644
+
1
−
0
View file @
0176b29d
Added missing is_playable serializer for the tracks endpoint.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment