From 9b05cde0d225b193877b437c022607a68bf39743 Mon Sep 17 00:00:00 2001 From: booploops <49113086+booploops@users.noreply.github.com> Date: Thu, 24 Feb 2022 05:04:17 -0800 Subject: [PATCH] fix for context menu follow --- src/renderer/views/pages/cider-playlist.ejs | 19 +++++++++++++------ src/renderer/views/pages/playlist-inline.ejs | 20 ++++++++++++++------ 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/src/renderer/views/pages/cider-playlist.ejs b/src/renderer/views/pages/cider-playlist.ejs index aa811295..27229fdf 100644 --- a/src/renderer/views/pages/cider-playlist.ejs +++ b/src/renderer/views/pages/cider-playlist.ejs @@ -413,6 +413,7 @@ }) }, menu(event) { + let self = this let menuItems = { items: { "share": { @@ -448,7 +449,7 @@ icon: "./assets/feather/plus-circle.svg", hidden: false, action: () => { - app.followArtistById(this.data.id, true) + app.followArtistById(this.data.relationships.artists.data[0].id, true) } }, "unfollow": { @@ -456,18 +457,24 @@ icon: "./assets/feather/x-circle.svg", hidden: true, action: () => { - app.followArtistById(this.data.id, false) + app.followArtistById(this.data.relationships.artists.data[0].id, false) } }, } } - if(app.followingArtist(this.data.id)){ + if(typeof this.data.relationships.artists != "undefined") { + if(app.followingArtist(this.data.relationships.artists.data[0].id)){ + menuItems.items.follow.hidden = true + menuItems.items.unfollow.hidden = false + } else { + menuItems.items.follow.hidden = false + menuItems.items.unfollow.hidden = true + } + }else{ menuItems.items.follow.hidden = true - menuItems.items.unfollow.hidden = false - } else { - menuItems.items.follow.hidden = false menuItems.items.unfollow.hidden = true } + app.showMenuPanel(menuItems, event) }, diff --git a/src/renderer/views/pages/playlist-inline.ejs b/src/renderer/views/pages/playlist-inline.ejs index d0272b6a..520aaf4a 100644 --- a/src/renderer/views/pages/playlist-inline.ejs +++ b/src/renderer/views/pages/playlist-inline.ejs @@ -437,6 +437,7 @@ }) }, menu(event) { + let self = this let menuItems = { items: { "share": { @@ -472,7 +473,7 @@ icon: "./assets/feather/plus-circle.svg", hidden: false, action: () => { - app.followArtistById(this.data.id, true) + app.followArtistById(this.data.relationships.artists.data[0].id, true) } }, "unfollow": { @@ -480,20 +481,27 @@ icon: "./assets/feather/x-circle.svg", hidden: true, action: () => { - app.followArtistById(this.data.id, false) + app.followArtistById(this.data.relationships.artists.data[0].id, false) } }, } } - if(app.followingArtist(this.data.id)){ + if(typeof this.data.relationships.artists != "undefined") { + if(app.followingArtist(this.data.relationships.artists.data[0].id)){ + menuItems.items.follow.hidden = true + menuItems.items.unfollow.hidden = false + } else { + menuItems.items.follow.hidden = false + menuItems.items.unfollow.hidden = true + } + }else{ menuItems.items.follow.hidden = true - menuItems.items.unfollow.hidden = false - } else { - menuItems.items.follow.hidden = false menuItems.items.unfollow.hidden = true } + app.showMenuPanel(menuItems, event) + }, getItemParent: function (data) { kind = data.attributes.playParams.kind;