Block Mendeley import if ZotFile installed

This commit is contained in:
Tom Najdek 2022-11-09 14:19:52 +01:00
parent d131fe3dc9
commit 0e12126436
No known key found for this signature in database
GPG key ID: EEC61A7B4C667D77
2 changed files with 13 additions and 1 deletions

View file

@ -12,7 +12,7 @@ var Zotero_Import_Wizard = {
_mendeleyCode: null, _mendeleyCode: null,
_mendeleyAuth: null, _mendeleyAuth: null,
_mendeleyHasPreviouslyImported: false, _mendeleyHasPreviouslyImported: false,
_isZotfileInstalled: false,
init: async function () { init: async function () {
this._wizard = document.getElementById('import-wizard'); this._wizard = document.getElementById('import-wizard');
@ -22,6 +22,9 @@ var Zotero_Import_Wizard = {
//document.getElementById('radio-import-source-mendeley').hidden = false; //document.getElementById('radio-import-source-mendeley').hidden = false;
} }
const extensions = await Zotero.getInstalledExtensions();
this._isZotfileInstalled = !!extensions.find(extName => extName.match(/^ZotFile((?!disabled).)*$/));
const predicateID = Zotero.RelationPredicates.getID('mendeleyDB:documentUUID'); const predicateID = Zotero.RelationPredicates.getID('mendeleyDB:documentUUID');
if (predicateID) { if (predicateID) {
@ -95,6 +98,14 @@ var Zotero_Import_Wizard = {
break; break;
case 'radio-import-source-mendeley-online': case 'radio-import-source-mendeley-online':
if (this._isZotfileInstalled) {
this._onDone(
Zotero.getString('general.error'),
Zotero.getString('import.online.blockedByPlugin', 'ZotFile'),
false
);
return;
}
wizard.goTo('mendeley-online-explanation'); wizard.goTo('mendeley-online-explanation');
wizard.canRewind = true; wizard.canRewind = true;
break; break;

View file

@ -813,6 +813,7 @@ import.online.formIntro = Please enter your credentials to log in to %2$S. This
import.online.intro = In the next step you will be asked to log in to %2$S and grant %1$S access. This is necessary to import your %3$S library into %1$S. import.online.intro = In the next step you will be asked to log in to %2$S and grant %1$S access. This is necessary to import your %3$S library into %1$S.
import.online.intro2 = %1$S will never see or store your %2$S password. import.online.intro2 = %1$S will never see or store your %2$S password.
import.online.wrongCredentials = Login to %1$S failed. Please re-enter credentials and try again. import.online.wrongCredentials = Login to %1$S failed. Please re-enter credentials and try again.
import.online.blockedByPlugin = The import cannot continue with "%1$S" installed. Please disable this plugin and try again.
quickCopy.copyAs = Copy as %S quickCopy.copyAs = Copy as %S