From 6a3cb3b1be1cd8445af44a65cf667e07901351ee Mon Sep 17 00:00:00 2001 From: Julian Anderson Date: Thu, 16 Nov 2023 20:14:39 -0500 Subject: [PATCH] mb-reledit-set_instruments: typeID fix Per https://community.metabrainz.org/t/replace-artist-role-userscript/665197, this userscript has not been functional for a while. Apparently, the changes in this commit will do the trick to make it work. --- mb-reledit-set_instruments.user.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mb-reledit-set_instruments.user.js b/mb-reledit-set_instruments.user.js index d07f37f..099b19e 100644 --- a/mb-reledit-set_instruments.user.js +++ b/mb-reledit-set_instruments.user.js @@ -29,7 +29,7 @@ const setInstrument = (fromType, toType, fromAttrId, toAttrId, toCredit) => { ).filter( rel => ( (isNaN(fromAttrId) && rel.attributes.length === 0) - || rel.attributes.map(attr => attr.type.id).includes(fromAttrId) + || rel.attributes.map(attr => attr.typeID).includes(fromAttrId) ) ).forEach(async (rel, relIdx) => { await helper.delay(relIdx * 10); @@ -64,8 +64,8 @@ const setInstrument = (fromType, toType, fromAttrId, toAttrId, toCredit) => { let idx; let attrs = rel.attributes; if (!isNaN(fromAttrId)) { - idx = attrs.findIndex(attr => attr.type.id == fromAttrId); - attrs = attrs.filter(attr => attr.type.id != fromAttrId); + idx = attrs.findIndex(attr => attr.typeID == fromAttrId); + attrs = attrs.filter(attr => attr.typeID != fromAttrId); } if (toAttr) { // attrs order must be kept for credits, etc.