From 3b66493e84d1c0c37e064b5ace991a5aaa2983d7 Mon Sep 17 00:00:00 2001 From: greta Date: Tue, 24 Oct 2023 18:27:48 +0200 Subject: [PATCH] fixup! Import file FileAction 28 compatibility Signed-off-by: greta --- src/files-action.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/files-action.js b/src/files-action.js index 270cce72d..573dce2f1 100644 --- a/src/files-action.js +++ b/src/files-action.js @@ -26,7 +26,7 @@ const mime = 'text/vcard' const name = 'contacts-import' window.addEventListener('DOMContentLoaded', () => { - if (!nextcloudVersion >= 26 && OCA.Files && OCA?.Files?.fileActions) { + if (!nextcloudIsGreaterThan26 && OCA.Files && OCA?.Files?.fileActions) { OCA.Files.fileActions.registerAction({ name, displayName: t('contacts', 'Import'), @@ -44,7 +44,7 @@ window.addEventListener('DOMContentLoaded', () => { console.error('Unable to register vcf import action') }) -if (nextcloudVersion >= 26) { +if (nextcloudIsGreaterThan26) { registerFileAction(new FileAction({ name, displayName() { @@ -61,3 +61,9 @@ if (nextcloudVersion >= 26) { }), ) } +/** + * @return the nextcloud version + */ +nextcloudIsGreaterThan26: function() { + return parseInt(OC.config.version.split('.')[0]) >=26 +}