Assume import translators updated after today are async

See https://github.com/zotero/translators/issues/1353 for details.

minVersion is problematic for various reasons, so this is safer.
This commit is contained in:
Dan Stillman 2017-07-05 08:52:37 -04:00
parent d73fc63273
commit 909b4b31c8

View file

@ -81,8 +81,9 @@ Zotero.Translate.Sandbox = {
* @param {SandboxItem} An item created using the Zotero.Item class from the sandbox * @param {SandboxItem} An item created using the Zotero.Item class from the sandbox
*/ */
_itemDone: function (translate, item) { _itemDone: function (translate, item) {
var asyncTranslator = translate.translator[0].minVersion // https://github.com/zotero/translators/issues/1353
&& parseInt(translate.translator[0].minVersion.match(/^[0-9]+/)[0]) >= 5; var asyncTranslator = translate instanceof Zotero.Translate.Import
&& translate.translator[0].lastUpdated > '2017-07-05';
var run = function (resolve) { var run = function (resolve) {
Zotero.debug("Translate: Saving item"); Zotero.debug("Translate: Saving item");
@ -205,7 +206,7 @@ Zotero.Translate.Sandbox = {
// For synchronous import (when Promise isn't available in the sandbox or the do* // For synchronous import (when Promise isn't available in the sandbox or the do*
// function doesn't use it) and web translators, queue saves // function doesn't use it) and web translators, queue saves
if (!resolve || translate instanceof Zotero.Translate.Web || !asyncTranslator) { if (!resolve || !asyncTranslator) {
Zotero.debug("Translate: Saving via queue"); Zotero.debug("Translate: Saving via queue");
translate.saveQueue.push(item); translate.saveQueue.push(item);
if (resolve) { if (resolve) {