Fix not throwing appropriate errors when citations required and not present

Also fixes displaying Yes/No for regular exceptions (regression 0cb056c9)
This commit is contained in:
Adomas Venčkauskas 2019-04-26 15:10:49 +03:00
parent bd7cdbdc81
commit 96d6114c71

View file

@ -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",