Skip to content

Commit

Permalink
fixup! Import file FileAction 28 compatibility
Browse files Browse the repository at this point in the history
Signed-off-by: greta <gretadoci@gmail.com>
  • Loading branch information
GretaD committed Oct 24, 2023
1 parent ea8b95d commit 3b66493
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/files-action.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand All @@ -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() {
Expand All @@ -61,3 +61,9 @@ if (nextcloudVersion >= 26) {
}),
)
}
/**
* @return the nextcloud version
*/
nextcloudIsGreaterThan26: function() {
return parseInt(OC.config.version.split('.')[0]) >=26
}

0 comments on commit 3b66493

Please sign in to comment.