diff --git a/chrome/content/zotero/fileInterface.js b/chrome/content/zotero/fileInterface.js index fd06984f2..6a64ca064 100644 --- a/chrome/content/zotero/fileInterface.js +++ b/chrome/content/zotero/fileInterface.js @@ -341,6 +341,7 @@ var Zotero_File_Interface = new function() { Zotero.UnresponsiveScriptIndicator.enable(); if(importCollection) { + // TODO: yield or change to .queue() Zotero.Notifier.trigger('refresh', 'collection', importCollection.id); } if (!worked) { diff --git a/chrome/content/zotero/xpcom/data/collection.js b/chrome/content/zotero/xpcom/data/collection.js index 7d3aafe61..82a07bbd7 100644 --- a/chrome/content/zotero/xpcom/data/collection.js +++ b/chrome/content/zotero/xpcom/data/collection.js @@ -292,7 +292,7 @@ Zotero.Collection.prototype._saveData = Zotero.Promise.coroutine(function* (env) )); } if (!isNew) { - Zotero.Notifier.trigger('move', 'collection', this.id); + Zotero.Notifier.queue('move', 'collection', this.id); } env.parentIDs = parentIDs; } @@ -307,10 +307,10 @@ Zotero.Collection.prototype._finalizeSave = Zotero.Promise.coroutine(function* ( if (!env.options.skipNotifier) { if (env.isNew) { - Zotero.Notifier.trigger('add', 'collection', this.id, env.notifierData); + Zotero.Notifier.queue('add', 'collection', this.id, env.notifierData); } else { - Zotero.Notifier.trigger('modify', 'collection', this.id, env.notifierData); + Zotero.Notifier.queue('modify', 'collection', this.id, env.notifierData); } } @@ -611,7 +611,7 @@ Zotero.Collection.prototype._eraseData = Zotero.Promise.coroutine(function* (env //return Zotero.Collections.reloadAll(); if (!env.skipNotifier) { - Zotero.Notifier.trigger('delete', 'collection', collections, notifierData); + Zotero.Notifier.queue('delete', 'collection', collections, notifierData); } }); diff --git a/chrome/content/zotero/xpcom/data/group.js b/chrome/content/zotero/xpcom/data/group.js index 166cfdc9d..1c5fc13eb 100644 --- a/chrome/content/zotero/xpcom/data/group.js +++ b/chrome/content/zotero/xpcom/data/group.js @@ -245,10 +245,10 @@ Zotero.Group.prototype.save = Zotero.Promise.coroutine(function* () { yield this.load(); Zotero.Groups.register(this) }.bind(this))); - Zotero.Notifier.trigger('add', 'group', this.id); + Zotero.Notifier.queue('add', 'group', this.id); } else { - Zotero.Notifier.trigger('modify', 'group', this.id); + Zotero.Notifier.queue('modify', 'group', this.id); } }.bind(this)); }); @@ -293,7 +293,7 @@ Zotero.Group.prototype.erase = Zotero.Promise.coroutine(function* () { yield Zotero.DB.queryAsync(sql, this.libraryID) Zotero.Groups.unregister(this.id); - Zotero.Notifier.trigger('delete', 'group', this.id, notifierData); + Zotero.Notifier.queue('delete', 'group', this.id, notifierData); }.bind(this)); yield Zotero.purgeDataObjects(); diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js index 49b243f61..74dc75abe 100644 --- a/chrome/content/zotero/xpcom/data/item.js +++ b/chrome/content/zotero/xpcom/data/item.js @@ -1231,7 +1231,7 @@ Zotero.Item.prototype._saveData = Zotero.Promise.coroutine(function* (env) { } if (!env.options.skipNotifier) { - Zotero.Notifier.trigger('add', 'item', itemID, env.notifierData); + Zotero.Notifier.queue('add', 'item', itemID, env.notifierData); } } else { @@ -1240,7 +1240,7 @@ Zotero.Item.prototype._saveData = Zotero.Promise.coroutine(function* (env) { yield Zotero.DB.queryAsync(sql, env.sqlValues); if (!env.options.skipNotifier) { - Zotero.Notifier.trigger('modify', 'item', itemID, env.notifierData); + Zotero.Notifier.queue('modify', 'item', itemID, env.notifierData); } } @@ -1349,7 +1349,7 @@ Zotero.Item.prototype._saveData = Zotero.Promise.coroutine(function* (env) { let newParentItemNotifierData = {}; //newParentItemNotifierData[newParentItem.id] = {}; - Zotero.Notifier.trigger('modify', 'item', parentItemID, newParentItemNotifierData); + Zotero.Notifier.queue('modify', 'item', parentItemID, newParentItemNotifierData); switch (Zotero.ItemTypes.getName(itemTypeID)) { case 'note': @@ -1373,7 +1373,7 @@ Zotero.Item.prototype._saveData = Zotero.Promise.coroutine(function* (env) { let newParentItemNotifierData = {}; //newParentItemNotifierData[newParentItem.id] = {}; - Zotero.Notifier.trigger('modify', 'item', parentItemID, newParentItemNotifierData); + Zotero.Notifier.queue('modify', 'item', parentItemID, newParentItemNotifierData); } let oldParentKey = this._previousData.parentKey; @@ -1383,7 +1383,7 @@ Zotero.Item.prototype._saveData = Zotero.Promise.coroutine(function* (env) { if (oldParentItemID) { let oldParentItemNotifierData = {}; //oldParentItemNotifierData[oldParentItemID] = {}; - Zotero.Notifier.trigger('modify', 'item', oldParentItemID, oldParentItemNotifierData); + Zotero.Notifier.queue('modify', 'item', oldParentItemID, oldParentItemNotifierData); } else { Zotero.debug("Old source item " + oldParentKey @@ -1406,7 +1406,7 @@ Zotero.Item.prototype._saveData = Zotero.Promise.coroutine(function* (env) { yield this.loadCollections(); this.removeFromCollection(changedCollections[i]); - Zotero.Notifier.trigger( + Zotero.Notifier.queue( 'remove', 'collection-item', changedCollections[i] + '-' + this.id @@ -1472,9 +1472,9 @@ Zotero.Item.prototype._saveData = Zotero.Promise.coroutine(function* (env) { yield Zotero.DB.queryAsync(sql, itemID); // Refresh trash - Zotero.Notifier.trigger('refresh', 'trash', this.libraryID); + Zotero.Notifier.queue('refresh', 'trash', this.libraryID); if (this._deleted) { - Zotero.Notifier.trigger('trash', 'item', this.id); + Zotero.Notifier.queue('trash', 'item', this.id); } if (parentItemID) { @@ -1594,7 +1594,7 @@ Zotero.Item.prototype._saveData = Zotero.Promise.coroutine(function* (env) { // "OR REPLACE" allows changing type let sql = "INSERT OR REPLACE INTO itemTags (itemID, tagID, type) VALUES (?, ?, ?)"; yield Zotero.DB.queryAsync(sql, [this.id, tagID, tag.type ? tag.type : 0]); - Zotero.Notifier.trigger('add', 'item-tag', this.id + '-' + tag.tag); + Zotero.Notifier.queue('add', 'item-tag', this.id + '-' + tag.tag); } if (toRemove.length) { @@ -1604,7 +1604,7 @@ Zotero.Item.prototype._saveData = Zotero.Promise.coroutine(function* (env) { let tagID = Zotero.Tags.getID(this.libraryID, tag.tag); let sql = "DELETE FROM itemTags WHERE itemID=? AND tagID=? AND type=?"; yield Zotero.DB.queryAsync(sql, [this.id, tagID, tag.type ? tag.type : 0]); - Zotero.Notifier.trigger('remove', 'item-tag', this.id + '-' + tag.tag); + Zotero.Notifier.queue('remove', 'item-tag', this.id + '-' + tag.tag); } Zotero.Prefs.set('purge.tags', true); } @@ -1634,7 +1634,7 @@ Zotero.Item.prototype._saveData = Zotero.Promise.coroutine(function* (env) { yield Zotero.DB.queryAsync(sql, [collectionID, this.id, orderIndex]); yield this.ContainerObjectsClass.refreshChildItems(collectionID); - Zotero.Notifier.trigger('add', 'collection-item', collectionID + '-' + this.id); + Zotero.Notifier.queue('add', 'collection-item', collectionID + '-' + this.id); } if (toRemove.length) { @@ -1646,7 +1646,7 @@ Zotero.Item.prototype._saveData = Zotero.Promise.coroutine(function* (env) { for (let i=0; i