Skip to content

Commit

Permalink
mb-reledit-set_instruments: typeID fix
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
julian45 authored and loujine committed Nov 25, 2024
1 parent 289669e commit 6a3cb3b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mb-reledit-set_instruments.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 6a3cb3b

Please sign in to comment.