Skip to content

Commit

Permalink
Use some instead of every for the permission check
Browse files Browse the repository at this point in the history
Signed-off-by: greta <[email protected]>
  • Loading branch information
GretaD committed Nov 8, 2023
1 parent 1611f5e commit 7cd9992
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/Listener/LoadContactsFilesActions.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function handle(Event $event): void {
if (method_exists(Util::class, 'addInitScript')) {
Util::addInitScript(Application::APP_ID, 'contacts-files-action');
} else {
Util::addScript(Application::APP_ID, 'contacts-files-action');
Util::addScript(Application::APP_ID, 'contacts-files-action', 'files');
}
}
}
7 changes: 5 additions & 2 deletions src/files-action.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@ if (nextcloudVersionIsGreaterThanOr28) {
id: name,
displayName: () => t('contacts', 'Import'),
default: DefaultType.DEFAULT,
mime,
enabled: (nodes) => {
return nodes.every((node) => node.mime === mime && (node.permissions & Permission.READ))
if (nodes.length !== 1) {
return false
}
const node = nodes[0]
return node.mime === mime && (node.permissions & Permission.READ)
},
iconSvgInline: () => ContactSvg,
async exec(file) {
Expand Down

0 comments on commit 7cd9992

Please sign in to comment.