From b76fdd8e43a26e10125b26e5febdcfb038ee3836 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 24 Apr 2009 06:16:19 +0000 Subject: [PATCH] Set tag/creator purge flag on removals from items, and run purge on sync --- chrome/content/zotero/overlay.js | 2 +- chrome/content/zotero/xpcom/data/item.js | 12 +++++++++++- chrome/content/zotero/xpcom/data/tag.js | 6 +++++- chrome/content/zotero/xpcom/sync.js | 3 +++ chrome/content/zotero/xpcom/zotero.js | 5 ++--- 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/chrome/content/zotero/overlay.js b/chrome/content/zotero/overlay.js index 66f520752..546f11263 100644 --- a/chrome/content/zotero/overlay.js +++ b/chrome/content/zotero/overlay.js @@ -346,7 +346,7 @@ var ZoteroPane = new function() setTimeout("document.getElementById('zotero-tb-search').inputField.select();", 1); var d = new Date(); - Zotero.purgeDataObjects(true); + Zotero.purgeDataObjects(); var d2 = new Date(); Zotero.debug("Purged data tables in " + (d2 - d) + " ms"); diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js index 566db27ad..f45f7a238 100644 --- a/chrome/content/zotero/xpcom/data/item.js +++ b/chrome/content/zotero/xpcom/data/item.js @@ -908,11 +908,16 @@ Zotero.Item.prototype.removeCreator = function(orderIndex) { this._loadCreators(); } - if (!this._creators[orderIndex]) { + var creator = this.getCreator(orderIndex); + if (!creator) { throw ('No creator exists at position ' + orderIndex + ' in Zotero.Item.removeCreator()'); } + if (creator.ref.countLinkedItems() == 1) { + Zotero.Prefs.set('purge.creators', true); + } + // Shift creator orderIndexes down, going to length+1 so we clear the last one for (var i=orderIndex, max=this._creators.length+1; i