Fix tag type handling when merging items

Most importantly, don't change all tags to manual on the merged item.
This commit is contained in:
Dan Stillman 2019-05-29 05:42:22 -04:00
commit e33a2d730d
2 changed files with 41 additions and 1 deletions

View file

@ -820,7 +820,21 @@ Zotero.Items = function() {
// Add tags to master
var tags = otherItem.getTags();
for (let j = 0; j < tags.length; j++) {
item.addTag(tags[j].tag);
let tagName = tags[j].tag;
if (item.hasTag(tagName)) {
let type = item.getTagType(tagName);
// If existing manual tag, leave that
if (type == 0) {
continue;
}
// Otherwise, add the non-master item's tag, which may be manual, in which
// case it will remain at the end
item.addTag(tagName, tags[j].type);
}
// If no existing tag, add with the type from the non-master item
else {
item.addTag(tagName, tags[j].type);
}
}
// Add relation to track merge