feat: new-music notices come from the scanner; request notices and the original specs go
release / web (push) Failing after 1m29s
release / go (push) Successful in 1m55s
release / govulncheck (push) Successful in 19s
release / integration (push) Successful in 4m22s
release / android (push) Successful in 4m57s
release / Attach APK to the Release (tag releases only) (push) Canceled after 0s
release / Build + push container image (push) Canceled after 0s
release / Verify release artifacts (tag releases only) (push) Canceled after 0s
release / Build signed APK (push) Canceled after 4m23s
release / web (push) Failing after 1m29s
release / go (push) Successful in 1m55s
release / govulncheck (push) Successful in 19s
release / integration (push) Successful in 4m22s
release / android (push) Successful in 4m57s
release / Attach APK to the Release (tag releases only) (push) Canceled after 0s
release / Build + push container image (push) Canceled after 0s
release / Verify release artifacts (tag releases only) (push) Canceled after 0s
release / Build signed APK (push) Canceled after 4m23s
Request notifications (approved, declined, completed, pending) are removed
along with the request flow that produced them. A new_music kind takes the
"new music arrived" slot: when a scan or a watcher batch finishes, the
scanner claims every album not yet announced (albums.announced_at) and tells
every user about the ones that are new: an album with a track on disk and
no track older than itself. The first import into an empty library, and an
album formed only by retagging tracks already held, announce nothing. One
notice per scan, carrying up to 50 albums and the total; it is never
coalesced, so a notice already emailed can't quietly absorb later arrivals.
It feeds the daily summary email, grouped by artist. Defaults: inbox and
email on, phone off.
Migration 0103 deletes request-kind notification rows and prefs, swaps the
kind CHECKs to new_music, and adds albums.announced_at with every album
held marked announced, so the first scan after it announces nothing old.
Web and Android: labels, the Android "Requests" settings section becomes
"New music", the shade channel your_requests becomes new_music (the old one
is deleted at startup), and "/" opens Home in the app. TrackLabel moves to
the notifications package. docs/smart-music-{server,client}-spec.md are
deleted per the operator; an Android comment loses the word "exchanges".
Grimoire #7666, #7671.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,29 @@ DO UPDATE SET
|
||||
updated_at = now()
|
||||
RETURNING *;
|
||||
|
||||
-- name: AnyAlbumAnnounced :one
|
||||
-- False on a library no scan has announced yet: its first import is the
|
||||
-- library being set up, not new music arriving.
|
||||
SELECT EXISTS (SELECT 1 FROM albums WHERE announced_at IS NOT NULL);
|
||||
|
||||
-- name: ClaimUnannouncedAlbums :many
|
||||
-- Stamps every album not yet announced and returns them, so each album is
|
||||
-- claimed by exactly one scan even when a full scan and the watcher overlap.
|
||||
-- arrived is whether it is news: it has a track on disk, and none of its
|
||||
-- tracks is older than the album. An album that formed because files already
|
||||
-- in the library were retagged holds older tracks, and is not new music.
|
||||
WITH claimed AS (
|
||||
UPDATE albums SET announced_at = now()
|
||||
WHERE announced_at IS NULL
|
||||
RETURNING id, title, artist_id, created_at
|
||||
)
|
||||
SELECT c.id, c.title, ar.id AS artist_id, ar.name AS artist_name,
|
||||
(EXISTS (SELECT 1 FROM tracks t WHERE t.album_id = c.id AND t.missing_since IS NULL)
|
||||
AND NOT EXISTS (SELECT 1 FROM tracks t WHERE t.album_id = c.id AND t.added_at < c.created_at))::boolean AS arrived
|
||||
FROM claimed c
|
||||
JOIN artists ar ON ar.id = c.artist_id
|
||||
ORDER BY c.created_at, c.id;
|
||||
|
||||
-- name: GetAlbumByID :one
|
||||
SELECT * FROM albums WHERE id = $1;
|
||||
|
||||
|
||||
@@ -83,6 +83,9 @@ DELETE FROM user_notifications
|
||||
-- name: ListAdminUserIDs :many
|
||||
SELECT id FROM users WHERE is_admin = true ORDER BY created_at, id;
|
||||
|
||||
-- name: ListUserIDs :many
|
||||
SELECT id FROM users ORDER BY created_at, id;
|
||||
|
||||
-- name: ListNotificationPrefsForUser :many
|
||||
SELECT kind, inbox, phone, email
|
||||
FROM user_notification_prefs
|
||||
|
||||
Reference in New Issue
Block a user