www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 4f2bcb15d5731b4684727d23515be43d7bd637d0
parent 56eb416e3ee058594c1dec056cb408241650e04b
Author: Dan Stillman <dstillman@zotero.org>
Date:   Fri, 24 Oct 2008 23:03:53 +0000

Fix error when purging tags that have already been erased


Diffstat:
Mchrome/content/zotero/xpcom/data/tag.js | 5++++-
Mchrome/content/zotero/xpcom/data/tags.js | 11+++--------
2 files changed, 7 insertions(+), 9 deletions(-)

diff --git 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 @@ -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);