From 8642091d8e6d08e6fe5d0521d9d4da8542d62310 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 22 Jan 2025 03:13:19 -0500 Subject: [PATCH] Don't auto-select item after sync on upload error Bug from 2017 --- .../content/zotero/xpcom/sync/syncRunner.js | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/chrome/content/zotero/xpcom/sync/syncRunner.js b/chrome/content/zotero/xpcom/sync/syncRunner.js index 2c32209382..23ade0e21b 100644 --- a/chrome/content/zotero/xpcom/sync/syncRunner.js +++ b/chrome/content/zotero/xpcom/sync/syncRunner.js @@ -913,14 +913,25 @@ Zotero.Sync.Runner_Module = function (options = {}) { } - this.end = Zotero.Promise.coroutine(function* (options) { + this.end = async function (options) { _syncInProgress = false; - yield this.checkErrors(_errors, options); + await this.checkErrors(_errors, options); if (!options.restartSync) { this.updateIcons(_errors); + + // If foreground sync, trigger dialog button immediately for some errors + // (e.g., long tag fixer) + if (!options.background && _errors.length) { + if (_errors[0].dialogButtonImmediate) { + let maybePromise = _errors[0].dialogButtonCallback(); + if (maybePromise && maybePromise.then) { + await maybePromise; + } + } + } } _errors = []; - }); + }; /** @@ -1253,6 +1264,7 @@ Zotero.Sync.Runner_Module = function (options = {}) { options.restartSync = true; }); + e.dialogButtonImmediate = true; } else { // Note too long @@ -1296,14 +1308,6 @@ Zotero.Sync.Runner_Module = function (options = {}) { }; } } - - // If not a background sync, show dialog immediately - if (!options.background && e.dialogButtonCallback) { - let maybePromise = e.dialogButtonCallback(); - if (maybePromise && maybePromise.then) { - yield maybePromise; - } - } } } // Show warning for unknown data that couldn't be saved