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 <[email protected]>
  • Loading branch information
GretaD committed Oct 25, 2023
1 parent ea8b95d commit 809e787
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/files-action.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ import { translate as t } from '@nextcloud/l10n'
import { registerFileAction, FileAction } from '@nextcloud/files'

Check failure on line 24 in src/files-action.js

View workflow job for this annotation

GitHub Actions / eslint

Unable to resolve path to module '@nextcloud/files'

Check failure on line 24 in src/files-action.js

View workflow job for this annotation

GitHub Actions / eslint

"@nextcloud/files" is not found
const mime = 'text/vcard'
const name = 'contacts-import'
const nextcloudIsGreaterThan26 = parseInt(OC.config.version.split('.')[0]) >= 26

Check warning on line 27 in src/files-action.js

View check run for this annotation

Codecov / codecov/patch

src/files-action.js#L27

Added line #L27 was not covered by tests

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 +45,7 @@ window.addEventListener('DOMContentLoaded', () => {
console.error('Unable to register vcf import action')
})

if (nextcloudVersion >= 26) {
if (nextcloudIsGreaterThan26) {
registerFileAction(new FileAction({

Check warning on line 49 in src/files-action.js

View check run for this annotation

Codecov / codecov/patch

src/files-action.js#L49

Added line #L49 was not covered by tests
name,
displayName() {
Expand Down

0 comments on commit 809e787

Please sign in to comment.