fix(album): keep cover uploads out of Recently Added ordering

Cover upload/delete bumped album.updated_at to bust the artwork cache, but
recentlyAddedSort() and Subsonic albumCreatedAt() sort on updated_at when
RecentlyAddedByModTime is enabled, so a cover edit reordered Recently Added
and shifted the reported creation date.

Add a dedicated cover_art_updated_at column that UpdateImage bumps instead of
updated_at; the album artwork id, reader cache key, and UI cover URL fold it
into their cache-busting, so covers refresh everywhere while updated_at (and
Recently Added) stays untouched.

Also preserve uploaded_image across the phase-2 moved-track album-id change,
which previously copied only created_at.
This commit is contained in:
Deluan 2026-07-17 21:08:16 -04:00
commit 319662174e
12 changed files with 116 additions and 37 deletions

View file

@ -140,6 +140,8 @@ func (m *MockAlbumRepo) UpdateImage(id, filename string) error {
}
if al, ok := m.Data[id]; ok {
al.UploadedImage = filename
now := time.Now()
al.CoverArtUpdatedAt = &now
return nil
}
return model.ErrNotFound
@ -187,6 +189,10 @@ func (m *MockAlbumRepo) CopyAttributes(fromID, toID string, columns ...string) e
switch col {
case "created_at":
to.CreatedAt = from.CreatedAt
case "uploaded_image":
to.UploadedImage = from.UploadedImage
case "cover_art_updated_at":
to.CoverArtUpdatedAt = from.CoverArtUpdatedAt
}
}
if m.CopyAttributesCalls == nil {