Settings column and now-playing state table (phase 4, step 1)
CI / validate-monitoring (push) Successful in 7s
CI / lint (push) Successful in 13s
CI / federation-interop (push) Successful in 1m9s
CI / test (push) Successful in 3m5s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 6s

federation_settings gains now_playing_mode (off/profile/posts,
default off), validated in sharing.update() the same way visibility
is. New federation_now_playing table: one row per user, tracking what
we've last told the fediverse (profile_key/profile_updated_at,
post_key/post_posted_at) - separate from core's now_playing table,
which is what's actually playing right now.

Verified the migration both ways against the local dev database: full
downgrade to base and back up to heads on both branches, not just a
single-step round trip.

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 16:57:34 +01:00
1 parent 7d86bad929
commit cb8f9c997e
4 files changed
+80 -6

No files matched your search

+13 -5
View File
@@ -19,11 +19,12 @@ def test_unsaved_defaults_have_every_field_populated(fed_ctx, user):
"""settings_for() builds a transient object when a user has never saved settings; its
column defaults apply only on INSERT, so every field has to be set by hand."""
settings = sharing.settings_for(user.id)
assert (settings.timezone, settings.post_weekly_summary, settings.post_milestones) == (
"UTC",
True,
True,
)
assert (
settings.timezone,
settings.post_weekly_summary,
settings.post_milestones,
settings.now_playing_mode,
) == ("UTC", True, True, "off")
def test_enabling_creates_a_key_pair_that_signs(fed_ctx, user):
@@ -83,6 +84,7 @@ def test_shared_user_is_case_insensitive_and_requires_sharing(fed_ctx, user, mak
{"enabled": True, "handle": "x"},
{"timezone": "Mars/Phobos"},
{"timezone": ""},
{"now_playing_mode": "always"},
],
)
def test_invalid_changes_are_rejected(fed_ctx, user, changes):
@@ -93,3 +95,9 @@ def test_invalid_changes_are_rejected(fed_ctx, user, changes):
def test_a_valid_timezone_can_be_set(fed_ctx, user):
settings, _ = sharing.update(user.id, {"timezone": "Pacific/Auckland"})
assert settings.timezone == "Pacific/Auckland"
@pytest.mark.parametrize("mode", ["off", "profile", "posts"])
def test_now_playing_mode_can_be_set(fed_ctx, user, mode):
settings, _ = sharing.update(user.id, {"now_playing_mode": mode})
assert settings.now_playing_mode == mode