fix: the playback-error test matches the prefixed username, and announcementFor keeps detekt's two returns (M542)
release / govulncheck (push) Successful in 15s
release / web (push) Successful in 1m25s
release / go (push) Successful in 1m35s
release / integration (push) Successful in 5m7s
release / android (push) Successful in 5m8s
release / Build signed APK (releases and dev) (push) Successful in 5m20s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 14s
release / Verify release artifacts (tag releases only) (push) Skipped

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-19 22:53:13 -04:00
co-authored by Claude Opus 5.5
parent 854c307834
commit 8538f0dc68
2 changed files with 15 additions and 13 deletions
@@ -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))