Skip to content

Commit

Permalink
Don't show Artist Page for "Various Artists"
Browse files Browse the repository at this point in the history
  • Loading branch information
deluan committed Sep 27, 2021
1 parent 0b65a4e commit c6868ff
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions server/serve_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func serveIndex(ds model.DataStore, fs fs.FS) http.HandlerFunc {
appConfig := map[string]interface{}{
"version": consts.Version(),
"firstTime": firstTime,
"variousArtistsId": consts.VariousArtistsID,
"baseURL": policy.Sanitize(strings.TrimSuffix(conf.Server.BaseURL, "/")),
"loginBackgroundURL": policy.Sanitize(conf.Server.UILoginBackgroundURL),
"welcomeMessage": policy.Sanitize(conf.Server.UIWelcomeMessage),
Expand Down
11 changes: 11 additions & 0 deletions server/serve_index_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@ var _ = Describe("serveIndex", func() {
Expect(config).To(HaveKeyWithValue("firstTime", true))
})

It("includes the VariousArtistsID", func() {
mockUser.empty = true
r := httptest.NewRequest("GET", "/index.html", nil)
w := httptest.NewRecorder()

serveIndex(ds, fs)(w, r)

config := extractAppConfig(w.Body.String())
Expect(config).To(HaveKeyWithValue("variousArtistsId", consts.VariousArtistsID))
})

It("sets firstTime = false when User table is not empty", func() {
mockUser.empty = false
r := httptest.NewRequest("GET", "/index.html", nil)
Expand Down
2 changes: 1 addition & 1 deletion ui/src/common/ArtistLinkField.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import config from '../config'
export const useGetHandleArtistClick = (width) => {
const [perPage] = useAlbumsPerPage(width)
return (id) => {
return config.devShowArtistPage
return config.devShowArtistPage && id !== config.variousArtistsId
? `/artist/${id}/show`
: `/album?filter={"artist_id":"${id}"}&order=ASC&sort=maxYear&displayedFilters={"compilation":true}&perPage=${perPage}`
}
Expand Down
1 change: 1 addition & 0 deletions ui/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const defaultConfig = {
version: 'dev',
firstTime: false,
baseURL: '',
variousArtistsId: '03b645ef2100dfc42fa9785ea3102295', // See consts.VariousArtistsID in consts.go
// Login backgrounds from https://unsplash.com/collections/1065384/music-wallpapers
loginBackgroundURL: 'https://source.unsplash.com/collection/1065384/1600x900',
enableTranscodingConfig: true,
Expand Down

0 comments on commit c6868ff

Please sign in to comment.