Skip to content

Commit

Permalink
fixup! Add shared items and events for each contact
Browse files Browse the repository at this point in the history
Signed-off-by: greta <[email protected]>
  • Loading branch information
GretaD committed Nov 7, 2023
1 parent 48f417e commit d8e2e6a
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions src/files-action.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,11 @@
*
*/
import { generateUrl } from '@nextcloud/router'
import { translate as t } from '@nextcloud/l10n'
import { registerFileAction, FileAction } from '@nextcloud/files'
const mime = 'text/vcard'
const name = 'contacts-import'
const nextcloudIsGreaterThan26 = parseInt(OC.config.version.split('.')[0]) >= 26

window.addEventListener('DOMContentLoaded', () => {
if (!nextcloudIsGreaterThan26 && OCA.Files && OCA?.Files?.fileActions) {
if (OCA.Files && OCA?.Files?.fileActions) {
OCA.Files.fileActions.registerAction({
name,
displayName: t('contacts', 'Import'),
Expand All @@ -44,21 +41,3 @@ window.addEventListener('DOMContentLoaded', () => {
}
console.error('Unable to register vcf import action')
})

if (nextcloudIsGreaterThan26) {
registerFileAction(new FileAction({
name,
displayName() {
return t('contacts', 'Import')
},
default: 'default',
mime,
permissions: OC.PERMISSION_READ,
iconClass: 'icon-contacts-dark',
actionHandler(fileName, context) {
const absPath = `${context.dir === '/' ? '' : context.dir}/${fileName}`
window.location = generateUrl(`/apps/contacts/import?file=${absPath}`)
},
}),
)
}

0 comments on commit d8e2e6a

Please sign in to comment.