commit 2e74cd7831665a217c9f442294c99b48ec2b6924
parent 69041832e7dbb5059c0fa9089476bb49ca0dce0c
Author: Dan Stillman <dstillman@zotero.org>
Date: Fri, 16 Jun 2017 05:40:04 -0400
Don't select new feeds or groups during sync
Diffstat:
6 files changed, 32 insertions(+), 23 deletions(-)
diff --git a/chrome/content/zotero/xpcom/collectionTreeView.js b/chrome/content/zotero/xpcom/collectionTreeView.js
@@ -259,8 +259,10 @@ Zotero.CollectionTreeView.prototype.refresh = Zotero.Promise.coroutine(function*
});
-/*
- * Redisplay everything
+/**
+ * Refresh tree and invalidate
+ *
+ * See note for refresh() for requirements of calling code
*/
Zotero.CollectionTreeView.prototype.reload = function()
{
@@ -433,13 +435,11 @@ Zotero.CollectionTreeView.prototype.notify = Zotero.Promise.coroutine(function*
}
this._removeRow(row);
yield this._addSortedRow('collection', id);
- if (!extraData[id].skipSelect) {
- yield this.selectByID(currentTreeRow.id);
- if (reopen) {
- let newRow = this.getRowIndexByID(rowID);
- if (!this.isContainerOpen(newRow)) {
- yield this.toggleOpenState(newRow);
- }
+ yield this.selectByID(currentTreeRow.id);
+ if (reopen) {
+ let newRow = this.getRowIndexByID(rowID);
+ if (!this.isContainerOpen(newRow)) {
+ yield this.toggleOpenState(newRow);
}
}
}
@@ -484,17 +484,13 @@ Zotero.CollectionTreeView.prototype.notify = Zotero.Promise.coroutine(function*
break;
case 'group':
- if (ids.length != 1) {
+ case 'feed':
+ if (type == 'groups' && ids.length != 1) {
Zotero.logError("WARNING: Multiple groups shouldn't currently be added "
+ "together in collectionTreeView::notify()")
}
yield this.reload();
- yield this.selectByID(currentTreeRow.id);
- break;
-
- case 'feed':
- yield this.reload();
- yield this.selectByID("L" + id);
+ yield this.selectByID(selectRow ? "L" + id : currentTreeRow.id);
break;
}
}
diff --git a/chrome/content/zotero/xpcom/data/feed.js b/chrome/content/zotero/xpcom/data/feed.js
@@ -276,7 +276,9 @@ Zotero.Feed.prototype._saveData = Zotero.Promise.coroutine(function* (env) {
+ "VALUES (" + Array(params.length).fill('?').join(', ') + ")";
yield Zotero.DB.queryAsync(sql, params);
- Zotero.Notifier.queue('add', 'feed', this.libraryID, env.options.notifierQueue);
+ Zotero.Notifier.queue(
+ 'add', 'feed', this.libraryID, env.notifierData, env.options.notifierQueue
+ );
}
else if (changedCols.length) {
let sql = "UPDATE feeds SET " + changedCols.map(v => v + '=?').join(', ')
@@ -285,7 +287,9 @@ Zotero.Feed.prototype._saveData = Zotero.Promise.coroutine(function* (env) {
yield Zotero.DB.queryAsync(sql, params);
if (!env.options.skipNotifier) {
- Zotero.Notifier.queue('modify', 'feed', this.libraryID, env.options.notifierQueue);
+ Zotero.Notifier.queue(
+ 'modify', 'feed', this.libraryID, env.notifierData, env.options.notifierQueue
+ );
}
}
else {
diff --git a/chrome/content/zotero/xpcom/data/feeds.js b/chrome/content/zotero/xpcom/data/feeds.js
@@ -137,7 +137,9 @@ Zotero.Feeds = new function() {
// This could potentially be a massive list, so we save in a transaction.
yield Zotero.DB.executeTransaction(function* () {
for (let feed of newFeeds) {
- yield feed.save();
+ yield feed.save({
+ skipSelect: true
+ });
}
});
// Finally, update
@@ -190,7 +192,9 @@ Zotero.Feeds = new function() {
obj.cleanupUnreadAfter = json[url][2];
}
let feed = new Zotero.Feed(obj);
- yield feed.save();
+ yield feed.saveTx({
+ skipSelect: true
+ });
}
});
diff --git a/chrome/content/zotero/xpcom/data/group.js b/chrome/content/zotero/xpcom/data/group.js
@@ -198,7 +198,7 @@ Zotero.Group.prototype._saveData = Zotero.Promise.coroutine(function* (env) {
+ "VALUES (" + Array(params.length).fill('?').join(', ') + ")";
yield Zotero.DB.queryAsync(sql, params);
- Zotero.Notifier.queue('add', 'group', this.groupID);
+ Zotero.Notifier.queue('add', 'group', this.groupID, env.notifierData);
}
else if (changedCols.length) {
let sql = "UPDATE groups SET " + changedCols.map(v => v + '=?').join(', ')
@@ -207,7 +207,7 @@ Zotero.Group.prototype._saveData = Zotero.Promise.coroutine(function* (env) {
yield Zotero.DB.queryAsync(sql, params);
if (!env.options.skipNotifier) {
- Zotero.Notifier.queue('modify', 'group', this.groupID);
+ Zotero.Notifier.queue('modify', 'group', this.groupID, env.notifierData);
}
}
else {
diff --git a/chrome/content/zotero/xpcom/data/library.js b/chrome/content/zotero/xpcom/data/library.js
@@ -445,6 +445,9 @@ Zotero.Library.prototype.save = Zotero.Promise.coroutine(function* (options) {
try {
env.notifierData = {};
+ if (env.options.skipSelect) {
+ env.notifierData.skipSelect = true;
+ }
// Create transaction
if (env.options.tx) {
diff --git a/chrome/content/zotero/xpcom/sync/syncRunner.js b/chrome/content/zotero/xpcom/sync/syncRunner.js
@@ -527,7 +527,9 @@ Zotero.Sync.Runner_Module = function (options = {}) {
group.version = info.version;
group.archived = false;
group.fromJSON(info.data, Zotero.Users.getCurrentUserID());
- yield group.saveTx();
+ yield group.saveTx({
+ skipSelect: true
+ });
// Add group to library list
libraries.push(group.libraryID);