Settings API and schema for now_playing_mode (phase 4, step 4)
CI / lint (push) Successful in 13s
CI / validate-monitoring (push) Successful in 40s
CI / federation-interop (push) Successful in 1m8s
CI / test (push) Successful in 3m39s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 6s

now_playing_mode was already in sharing.EDITABLE (step 1), so
_settings_body() was already returning it - but SharingSettingsSchema
never declared the field, so marshmallow was silently dropping it from
every response. Same class of gap phase 3 hit with timezone/
post_weekly_summary/post_milestones.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
This commit is contained in:
mattandClaude Sonnet 5 committed 2026-09-26 17:15:51 +01:00
1 parent ba30d5cb15
commit 515acae233
3 files changed
+53 -3

No files matched your search

+13 -2
View File
@@ -1,6 +1,6 @@
from marshmallow import Schema, ValidationError, fields, validate
from scrobbler.federation.models import VISIBILITIES
from scrobbler.federation.models import NOW_PLAYING_MODES, VISIBILITIES
from scrobbler.federation.protocol.schedule import is_valid_timezone
@@ -44,6 +44,17 @@ class SharingSettingsSchema(Schema):
"description": "Post scrobble-count, artist-plays and top-10 milestones as you hit them"
}
)
now_playing_mode = fields.String(
validate=validate.OneOf(NOW_PLAYING_MODES),
metadata={
"description": (
'`off` (default): nothing. `profile`: a "Now playing" field on your '
"profile, refreshed at most every 5 minutes and cleared when you stop. "
"`posts`: the profile field, plus a post for each track played 30+ "
"seconds, at most one every 30 minutes, replacing the last one."
)
},
)
handle = fields.String(dump_only=True, metadata={"example": "@alice@scrobble.example"})
actor_url = fields.String(dump_only=True)
profile_url = fields.String(dump_only=True)
@@ -89,7 +100,7 @@ class BlockSchema(Schema):
class PostSchema(Schema):
id = fields.Integer()
kind = fields.String(metadata={"description": "weekly or milestone"})
kind = fields.String(metadata={"description": "weekly, milestone or now_playing"})
text = fields.String()
visibility = fields.String()
created_at = fields.DateTime()