diff --git a/chrome/content/zotero/xpcom/data/collection.js b/chrome/content/zotero/xpcom/data/collection.js index 912c29026..7ccdb8eb4 100644 --- a/chrome/content/zotero/xpcom/data/collection.js +++ b/chrome/content/zotero/xpcom/data/collection.js @@ -561,12 +561,6 @@ Zotero.Collection.prototype._eraseData = Zotero.Promise.coroutine(function* (env var descendents = yield this.getDescendents(false, null, true); var items = []; - var notifierData = {}; - notifierData[this.id] = { - libraryID: this.libraryID, - key: this.key - }; - var del = []; for(var i=0, len=descendents.length; i parseInt(id)), + env.notifierData + ); + } +} /** * Generates data object key diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js index fcb8856af..485c4c4fc 100644 --- a/chrome/content/zotero/xpcom/data/item.js +++ b/chrome/content/zotero/xpcom/data/item.js @@ -3720,19 +3720,6 @@ Zotero.Item.prototype.copy = Zotero.Promise.coroutine(function* () { });; -Zotero.Item.prototype._eraseInit = Zotero.Promise.coroutine(function* (env) { - var proceed = yield Zotero.Item._super.prototype._eraseInit.apply(this, arguments); - if (!proceed) return false; - - env.deletedItemNotifierData = {}; - env.deletedItemNotifierData[this.id] = { - libraryID: this.libraryID, - key: this.key - }; - - return true; -}); - Zotero.Item.prototype._eraseData = Zotero.Promise.coroutine(function* (env) { Zotero.DB.requireTransaction(); @@ -3792,21 +3779,11 @@ Zotero.Item.prototype._eraseData = Zotero.Promise.coroutine(function* (env) { //Zotero.Fulltext.clearItemContent(this.id); } - env.parentItem = parentItem; -}); - -Zotero.Item.prototype._erasePreCommit = Zotero.Promise.coroutine(function* (env) { yield Zotero.DB.queryAsync('DELETE FROM items WHERE itemID=?', this.id); - if (env.parentItem) { - yield env.parentItem.reload(['primaryData', 'childItems'], true); - env.parentItem.clearBestAttachmentState(); - } - - this.ObjectsClass.unload(this.id); - - if (!env.options.skipNotifier) { - Zotero.Notifier.queue('delete', 'item', this.id, env.deletedItemNotifierData); + if (parentItem) { + yield parentItem.reload(['primaryData', 'childItems'], true); + parentItem.clearBestAttachmentState(); } Zotero.Prefs.set('purge.items', true); diff --git a/chrome/content/zotero/xpcom/search.js b/chrome/content/zotero/xpcom/search.js index 9774b21a3..c4316c75f 100644 --- a/chrome/content/zotero/xpcom/search.js +++ b/chrome/content/zotero/xpcom/search.js @@ -220,21 +220,11 @@ Zotero.Search.prototype.clone = function (libraryID) { Zotero.Search.prototype._eraseData = Zotero.Promise.coroutine(function* (env) { Zotero.DB.requireTransaction(); - var notifierData = {}; - notifierData[this.id] = { - libraryID: this.libraryID, - key: this.key - }; - var sql = "DELETE FROM savedSearchConditions WHERE savedSearchID=?"; yield Zotero.DB.queryAsync(sql, this.id); var sql = "DELETE FROM savedSearches WHERE savedSearchID=?"; yield Zotero.DB.queryAsync(sql, this.id); - - if (!env.options.skipNotifier) { - Zotero.Notifier.queue('delete', 'search', this.id, notifierData); - } }); diff --git a/test/tests/dataObjectsTest.js b/test/tests/dataObjectsTest.js index fe0dfa00f..9bc3285c3 100644 --- a/test/tests/dataObjectsTest.js +++ b/test/tests/dataObjectsTest.js @@ -42,7 +42,19 @@ describe("Zotero.DataObjects", function () { assert.isFalse(libraryKey); } }); - }); + }) + + describe("#exists()", function () { + it("should return false after object is deleted", function* () { + for (let type of types) { + let objectsClass = Zotero.DataObjectUtilities.getObjectsClassForObjectType(type); + let obj = yield createDataObject(type); + let id = obj.id; + yield obj.eraseTx(); + assert.isFalse(objectsClass.exists(id), type + " does not exist"); + } + }) + }) describe("#_setIdentifier", function () { it("should not allow an id change", function* () {