fix for context menu follow

This commit is contained in:
booploops 2022-02-24 05:04:17 -08:00
parent 80f78edbf3
commit 9b05cde0d2
2 changed files with 27 additions and 12 deletions

View file

@ -413,6 +413,7 @@
}) })
}, },
menu(event) { menu(event) {
let self = this
let menuItems = { let menuItems = {
items: { items: {
"share": { "share": {
@ -448,7 +449,7 @@
icon: "./assets/feather/plus-circle.svg", icon: "./assets/feather/plus-circle.svg",
hidden: false, hidden: false,
action: () => { action: () => {
app.followArtistById(this.data.id, true) app.followArtistById(this.data.relationships.artists.data[0].id, true)
} }
}, },
"unfollow": { "unfollow": {
@ -456,18 +457,24 @@
icon: "./assets/feather/x-circle.svg", icon: "./assets/feather/x-circle.svg",
hidden: true, hidden: true,
action: () => { 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.follow.hidden = true
menuItems.items.unfollow.hidden = false
} else {
menuItems.items.follow.hidden = false
menuItems.items.unfollow.hidden = true menuItems.items.unfollow.hidden = true
} }
app.showMenuPanel(menuItems, event) app.showMenuPanel(menuItems, event)
}, },

View file

@ -437,6 +437,7 @@
}) })
}, },
menu(event) { menu(event) {
let self = this
let menuItems = { let menuItems = {
items: { items: {
"share": { "share": {
@ -472,7 +473,7 @@
icon: "./assets/feather/plus-circle.svg", icon: "./assets/feather/plus-circle.svg",
hidden: false, hidden: false,
action: () => { action: () => {
app.followArtistById(this.data.id, true) app.followArtistById(this.data.relationships.artists.data[0].id, true)
} }
}, },
"unfollow": { "unfollow": {
@ -480,20 +481,27 @@
icon: "./assets/feather/x-circle.svg", icon: "./assets/feather/x-circle.svg",
hidden: true, hidden: true,
action: () => { 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.follow.hidden = true
menuItems.items.unfollow.hidden = false
} else {
menuItems.items.follow.hidden = false
menuItems.items.unfollow.hidden = true menuItems.items.unfollow.hidden = true
} }
app.showMenuPanel(menuItems, event) app.showMenuPanel(menuItems, event)
}, },
getItemParent: function (data) { getItemParent: function (data) {
kind = data.attributes.playParams.kind; kind = data.attributes.playParams.kind;