mirror of
https://github.com/navidrome/navidrome.git
synced 2026-11-13 13:48:39 +01:00
fix(subsonic): expose cover cache-buster on bookmarked songs
GetBookmarks selected media_file.* without the album cover-stamp projection, so bookmarked songs kept emitting the pre-edit coverArt id after a cover upload/delete. With this fourth copy of the projection appearing, extract it into a shared coverArtUpdatedAtCol helper used by all media_file read paths (list, playlist tracks, single playlist track, bookmarks).
This commit is contained in:
parent
a5d3d615d8
commit
d509d8b2f8
6 changed files with 32 additions and 6 deletions
|
|
@ -3,6 +3,7 @@ package persistence
|
|||
import (
|
||||
"context"
|
||||
|
||||
"github.com/Masterminds/squirrel"
|
||||
"github.com/navidrome/navidrome/log"
|
||||
"github.com/navidrome/navidrome/model"
|
||||
"github.com/navidrome/navidrome/model/request"
|
||||
|
|
@ -70,5 +71,24 @@ var _ = Describe("sqlBookmarks", func() {
|
|||
Expect(mr.DeleteBookmark(songComeTogether.ID)).To(Succeed())
|
||||
Expect(mr.GetBookmarks()).To(BeEmpty())
|
||||
})
|
||||
|
||||
It("exposes the album's cover timestamp on bookmarked songs", func() {
|
||||
albumRepo := NewAlbumRepository(request.WithUser(GinkgoT().Context(), model.User{ID: "userid"}), GetDBXBuilder()).(*albumRepository)
|
||||
Expect(mr.AddBookmark(songAntenna.ID, "cover test", 1)).To(Succeed())
|
||||
DeferCleanup(func() {
|
||||
_ = mr.DeleteBookmark(songAntenna.ID)
|
||||
// Restore both columns so fixture-equality tests stay untouched
|
||||
_, _ = albumRepo.executeSQL(squirrel.Update("album").
|
||||
Set("uploaded_image", "").Set("cover_art_updated_at", nil).
|
||||
Where(squirrel.Eq{"id": songAntenna.AlbumID}))
|
||||
})
|
||||
|
||||
Expect(albumRepo.UpdateImage(songAntenna.AlbumID, "cover-bm.jpg")).To(Succeed())
|
||||
|
||||
bms, err := mr.GetBookmarks()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(bms).To(HaveLen(1))
|
||||
Expect(bms[0].Item.CoverArtUpdatedAt).ToNot(BeNil())
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue