From 6834c6062b961aa46fc576e0dc7919b8f24f6401 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 14 May 2021 05:13:19 -0400 Subject: [PATCH] Fix auto-sync timeout in notes Regression in 7ace5ea29 --- chrome/content/zotero/xpcom/data/dataObject.js | 4 ++-- chrome/content/zotero/xpcom/notifier.js | 4 ++-- chrome/content/zotero/xpcom/sync/syncRunner.js | 4 ++++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/chrome/content/zotero/xpcom/data/dataObject.js b/chrome/content/zotero/xpcom/data/dataObject.js index 1b09572b37..ca87a58a3e 100644 --- a/chrome/content/zotero/xpcom/data/dataObject.js +++ b/chrome/content/zotero/xpcom/data/dataObject.js @@ -927,8 +927,8 @@ Zotero.DataObject.prototype.save = Zotero.Promise.coroutine(function* (options = } // Pass along event-level notifier options, which become top-level extraData properties for (let option of Zotero.Notifier.EVENT_LEVEL_OPTIONS) { - if (env.options[option]) { - env.notifierData[option] = true; + if (env.options[option] !== undefined) { + env.notifierData[option] = env.options[option]; } } if (!env.isNew) { diff --git a/chrome/content/zotero/xpcom/notifier.js b/chrome/content/zotero/xpcom/notifier.js index 59d7a0c56f..387c16a13d 100644 --- a/chrome/content/zotero/xpcom/notifier.js +++ b/chrome/content/zotero/xpcom/notifier.js @@ -206,8 +206,8 @@ Zotero.Notifier = new function(){ if (extraData) { // Set event-level options as top-level properties in extraData for (let option of Zotero.Notifier.EVENT_LEVEL_OPTIONS) { - if (extraData[option]) { - queue[type][event].data[option] = true; + if (extraData[option] !== undefined) { + queue[type][event].data[option] = extraData[option]; delete extraData[option]; } } diff --git a/chrome/content/zotero/xpcom/sync/syncRunner.js b/chrome/content/zotero/xpcom/sync/syncRunner.js index cb12776127..2327b5652f 100644 --- a/chrome/content/zotero/xpcom/sync/syncRunner.js +++ b/chrome/content/zotero/xpcom/sync/syncRunner.js @@ -936,6 +936,10 @@ Zotero.Sync.Runner_Module = function (options = {}) { throw new Error("Timeout not provided"); } + if (timeout != parseInt(timeout)) { + throw new Error(`Timeout must be an integer (${timeout} given)`); + } + if (_autoSyncTimer) { Zotero.debug("Cancelling auto-sync timer"); _autoSyncTimer.cancel();