From 96d6114c710e687b54bf424d24acdc6874bc836b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adomas=20Ven=C4=8Dkauskas?= Date: Fri, 26 Apr 2019 15:10:49 +0300 Subject: [PATCH] Fix not throwing appropriate errors when citations required and not present Also fixes displaying Yes/No for regular exceptions (regression 0cb056c9) --- chrome/content/zotero/xpcom/integration.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/chrome/content/zotero/xpcom/integration.js b/chrome/content/zotero/xpcom/integration.js index 5314992e10..9d15982ad0 100644 --- a/chrome/content/zotero/xpcom/integration.js +++ b/chrome/content/zotero/xpcom/integration.js @@ -332,9 +332,13 @@ Zotero.Integration = new function() { if (document) { try { await document.activate(); - let index = await document.displayAlert(displayError, DIALOG_ICON_STOP, DIALOG_BUTTONS_YES_NO); - if (index == 1) { - Zotero.launchURL(supportURL); + if (e instanceof Zotero.Exception.Alert) { + await document.displayAlert(displayError, DIALOG_ICON_STOP, DIALOG_BUTTONS_OK); + } else { + let index = await document.displayAlert(displayError, DIALOG_ICON_STOP, DIALOG_BUTTONS_YES_NO); + if (index == 1) { + Zotero.launchURL(supportURL); + } } return; } @@ -1435,7 +1439,7 @@ Zotero.Integration.Session.prototype.init = Zotero.Promise.coroutine(function *( } } - if (require && (!haveFields && !data.prefs.fieldType)) { + if (require && (!haveFields && data.prefs.fieldType)) { // If required but no fields and preferences exist throw an error return Zotero.Promise.reject(new Zotero.Exception.Alert( "integration.error.mustInsertCitation",