Fix duplicate custom modifiers restoration

Fix for duplicate image modifiers when restoring a task in which several custom modifier cards share the same tag.
This commit is contained in:
patriceac 2022-11-19 19:21:36 -08:00 committed by GitHub
parent adcd4368e7
commit 577dd9048f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -166,11 +166,13 @@ function refreshModifiersState(newTags) {
const modifierName = modifierCard.querySelector('.modifier-card-label').innerText
if (tag == modifierName) {
// add modifier to active array
activeTags.push({
'name': modifierName,
'element': modifierCard.cloneNode(true),
'originElement': modifierCard
})
if (!activeTags.map(x => x.name).includes(tag)) { // only add each tag once even if several custom modifier cards share the same tag
activeTags.push({
'name': modifierName,
'element': modifierCard.cloneNode(true),
'originElement': modifierCard
})
}
modifierCard.classList.add(activeCardClass)
modifierCard.querySelector('.modifier-card-image-overlay').innerText = '-'
found = true