DLNA renderers, app updates told like Librarian, acquisition without Lidarr, Collection and admin rework (M502–M505, M542) #156

Merged
bvandeusen merged 117 commits from dev into main 2026-10-26 12:32:33 -04:00
2 changed files with 15 additions and 13 deletions
Showing only changes of commit 8538f0dc68 - Show all commits
@@ -66,18 +66,20 @@ internal sealed interface Announcement {
/** How many titles an expanded pile lists, newest first. */
internal const val PILE_LINES = 5
internal fun announcementFor(fresh: List<CachedNotificationEntity>): Announcement? {
if (fresh.isEmpty()) return null
if (fresh.size <= INDIVIDUAL_LIMIT) return Announcement.Each(fresh)
// A pile goes where its notices would: library health only when every
// one of them is, so a listener's own news is never filed under it.
val channel = if (fresh.all { shadeChannelFor(it.kind) == ShadeChannel.LIBRARY_HEALTH }) {
ShadeChannel.LIBRARY_HEALTH
} else {
ShadeChannel.YOUR_REQUESTS
}
val lines = fresh.sortedByDescending { it.createdAt }.take(PILE_LINES).map { it.title }
return Announcement.Pile(fresh.size, channel, lines)
internal fun announcementFor(fresh: List<CachedNotificationEntity>): Announcement? = when {
fresh.isEmpty() -> null
fresh.size <= INDIVIDUAL_LIMIT -> Announcement.Each(fresh)
else -> Announcement.Pile(
count = fresh.size,
// A pile goes where its notices would: library health only when every
// one of them is, so a listener's own news is never filed under it.
channel = if (fresh.all { shadeChannelFor(it.kind) == ShadeChannel.LIBRARY_HEALTH }) {
ShadeChannel.LIBRARY_HEALTH
} else {
ShadeChannel.YOUR_REQUESTS
},
lines = fresh.sortedByDescending { it.createdAt }.take(PILE_LINES).map { it.title },
)
}
/** The phone channel per kind, as the user set it. No settings cached: on, the default for every kind. */
+1 -1
View File
@@ -212,7 +212,7 @@ func TestNotify_PlaybackErrorsCoalesceIntoOneCount(t *testing.T) {
got := inboxOf(t, pool, admin)
wantInbox(t, "admin", got, notifications.KindPlaybackErrors)
if got[0].Payload.Count != 2 || len(got[0].Payload.Items) != 2 ||
!strings.HasSuffix(got[0].Payload.Items[0], "(np-play-alice)") {
!strings.HasSuffix(got[0].Payload.Items[0], "np-play-alice)") {
t.Errorf("payload = %+v, want two reports, each naming the track and alice", got[0].Payload)
}
wantInbox(t, "reporter", inboxOf(t, pool, alice))