diff --git a/chrome/content/zotero/xpcom/data/tag.js b/chrome/content/zotero/xpcom/data/tag.js index b85130144a..8b1031937f 100644 --- a/chrome/content/zotero/xpcom/data/tag.js +++ b/chrome/content/zotero/xpcom/data/tag.js @@ -443,7 +443,7 @@ Zotero.Tag.prototype.serialize = function () { /** * Remove tag from all linked items * - * Tags.erase() should be used externally instead of this + * Tags.erase() should be used instead of tag.erase() for deleting multiple tags * * Actual deletion of tag occurs in Zotero.Tags.purge() */ @@ -484,6 +484,9 @@ Zotero.Tag.prototype.erase = function () { itemTags.push(itemID + '-' + this.id); } + + this.unload(this.id); + Zotero.Notifier.trigger('remove', 'item-tag', itemTags); // Send notification of linked items diff --git a/chrome/content/zotero/xpcom/data/tags.js b/chrome/content/zotero/xpcom/data/tags.js index 3912910038..da571c111d 100644 --- a/chrome/content/zotero/xpcom/data/tags.js +++ b/chrome/content/zotero/xpcom/data/tags.js @@ -315,19 +315,13 @@ Zotero.Tags = new function() { function erase(ids) { ids = Zotero.flattenArguments(ids); - var erasedTags = {}; - Zotero.DB.beginTransaction(); for each(var id in ids) { var tag = this.get(id); if (tag) { - erasedTags[id] = tag.serialize(); tag.erase(); } } - - this.unload(ids); - Zotero.DB.commitTransaction(); } @@ -364,8 +358,9 @@ Zotero.Tags = new function() { for each(var tagID in toDelete) { var tag = Zotero.Tags.get(tagID); - Zotero.debug(tag); - notifierData[tagID] = { old: tag.serialize() } + if (tag) { + notifierData[tagID] = { old: tag.serialize() } + } } this.unload(toDelete);