From e44a9c4363dff4fe5f4861bc3f12277d4e40f77c Mon Sep 17 00:00:00 2001 From: Agate Date: Tue, 7 Jul 2020 19:18:05 +0200 Subject: [PATCH] Fix #1080: broken artist and album pages --- front/src/components/audio/PlayButton.vue | 6 ++++-- front/src/components/library/AlbumBase.vue | 5 ++++- front/src/components/library/ArtistBase.vue | 4 +--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/front/src/components/audio/PlayButton.vue b/front/src/components/audio/PlayButton.vue index de299a383..1a46b5774 100644 --- a/front/src/components/audio/PlayButton.vue +++ b/front/src/components/audio/PlayButton.vue @@ -107,10 +107,12 @@ export default { return this.track.uploads && this.track.uploads.length > 0 } else if (this.artist && this.artist.tracks_count) { return this.artist.tracks_count > 0 - } else if (this.artist && this.artist.albums) { + } else if (this.artist && this.artist.albums) { return this.artist.albums.filter((a) => { return a.is_playable === true }).length > 0 + } else if (this.album) { + return this.album.is_playable } else if (this.tracks) { return this.tracks.filter((t) => { return t.uploads && t.uploads.length > 0 @@ -229,6 +231,7 @@ export default { jQuery(self.$el).find('.ui.dropdown').dropdown('hide') }, addNext (next) { + console.log('CLICKED') let self = this let wasEmpty = this.$store.state.queue.tracks.length === 0 this.getPlayableTracks().then((tracks) => { @@ -253,7 +256,6 @@ export default { }, watch: { clicked () { - let self = this this.$nextTick(() => { jQuery(this.$el).find('.ui.dropdown').dropdown({ diff --git a/front/src/components/library/AlbumBase.vue b/front/src/components/library/AlbumBase.vue index 071b13357..7b572e145 100644 --- a/front/src/components/library/AlbumBase.vue +++ b/front/src/components/library/AlbumBase.vue @@ -169,13 +169,16 @@ export default { methods: { async fetchData() { this.isLoading = true + let tracksResponse = axios.get(`tracks/`, {params: {ordering: 'disc_number,position', album: this.id, page_size: 100}}) let albumResponse = await axios.get(`albums/${this.id}/`, {params: {refresh: 'true'}}) let artistResponse = await axios.get(`artists/${albumResponse.data.artist.id}/`) this.artist = artistResponse.data if (this.artist.channel) { this.artist.channel.artist = this.artist } - this.object = backend.Album.clean(albumResponse.data) + tracksResponse = await tracksResponse + this.object = albumResponse.data + this.object.tracks = tracksResponse.data.results this.discs = this.object.tracks.reduce(groupByDisc, []) this.isLoading = false diff --git a/front/src/components/library/ArtistBase.vue b/front/src/components/library/ArtistBase.vue index fefadd60b..725d91bbe 100644 --- a/front/src/components/library/ArtistBase.vue +++ b/front/src/components/library/ArtistBase.vue @@ -195,9 +195,7 @@ export default { self.nextAlbumsUrl = response.data.next self.totalAlbums = response.data.count let parsed = JSON.parse(JSON.stringify(response.data.results)) - self.albums = parsed.map(album => { - return backend.Album.clean(album) - }) + self.albums = parsed }) await trackPromise