From c203e3baa3c83aac689ca10c58476764f639cd7d Mon Sep 17 00:00:00 2001 From: Chris Fulljames Date: Fri, 29 Aug 2025 19:32:38 -0400 Subject: [PATCH] Launch push notifications feature --- src/littlesongplace/push_notifications.py | 11 ++++++----- src/littlesongplace/templates/base.html | 1 + src/littlesongplace/templates/news.html | 7 +++++++ src/littlesongplace/templates/settings.html | 8 +++++++- test/test_push_notifications.py | 2 +- 5 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/littlesongplace/push_notifications.py b/src/littlesongplace/push_notifications.py index 602758c..55b8cb6 100644 --- a/src/littlesongplace/push_notifications.py +++ b/src/littlesongplace/push_notifications.py @@ -209,18 +209,19 @@ def notify_new_songs_cmd(): new_songs = [s for s in new_songs if not s.hidden] # Filter out hidden songs unique_users = sorted(set(s.username for s in new_songs)) - title = None + title = f"New music!" + body = None _except = None if len(new_songs) == 1: - title = f"New song from {unique_users[0]}" + body = f"New song from {unique_users[0]}" _except = new_songs[0].userid elif len(new_songs) > 1: - title = f"New songs from {', '.join(unique_users)}" + body = f"New songs from {', '.join(unique_users)}" - if title: + if body: notify_all( title, - body=None, + body, url="/", setting=SubscriptionSetting.SONGS, _except=_except) diff --git a/src/littlesongplace/templates/base.html b/src/littlesongplace/templates/base.html index ef16269..4ab6b56 100644 --- a/src/littlesongplace/templates/base.html +++ b/src/littlesongplace/templates/base.html @@ -57,6 +57,7 @@