From 0e121264360bfee7fa84c51ab12ad5fdaa1e1624 Mon Sep 17 00:00:00 2001 From: Tom Najdek Date: Wed, 9 Nov 2022 14:19:52 +0100 Subject: [PATCH] Block Mendeley import if ZotFile installed --- chrome/content/zotero/import/importWizard.js | 13 ++++++++++++- chrome/locale/en-US/zotero/zotero.properties | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/import/importWizard.js b/chrome/content/zotero/import/importWizard.js index 621091dbd2..04a4706bf3 100644 --- a/chrome/content/zotero/import/importWizard.js +++ b/chrome/content/zotero/import/importWizard.js @@ -12,7 +12,7 @@ var Zotero_Import_Wizard = { _mendeleyCode: null, _mendeleyAuth: null, _mendeleyHasPreviouslyImported: false, - + _isZotfileInstalled: false, init: async function () { this._wizard = document.getElementById('import-wizard'); @@ -22,6 +22,9 @@ var Zotero_Import_Wizard = { //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'); if (predicateID) { @@ -95,6 +98,14 @@ var Zotero_Import_Wizard = { break; 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.canRewind = true; break; diff --git a/chrome/locale/en-US/zotero/zotero.properties b/chrome/locale/en-US/zotero/zotero.properties index f6dbc7f543..de6936fbd8 100644 --- a/chrome/locale/en-US/zotero/zotero.properties +++ b/chrome/locale/en-US/zotero/zotero.properties @@ -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.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.blockedByPlugin = The import cannot continue with "%1$S" installed. Please disable this plugin and try again. quickCopy.copyAs = Copy as %S