-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Import file FileAction 28 compatibility #3669
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #3669 +/- ##
==========================================
- Coverage 2.07% 0.00% -2.08%
- Complexity 0 261 +261
==========================================
Files 89 24 -65
Lines 5343 784 -4559
Branches 1491 0 -1491
==========================================
- Hits 111 0 -111
+ Misses 5114 784 -4330
+ Partials 118 0 -118
☔ View full report in Codecov by Sentry. |
3b66493
to
809e787
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested it and it works no master and stable27. Please address the feedback regarding jshint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and works. I fixed some minor bugs and merged both if statements.
Please squash all commits and we are ready to merge :)
Signed-off-by: greta <gretadoci@gmail.com>
20b4bee
to
5493404
Compare
if (method_exists(Util::class, 'addInitScript')) { | ||
Util::addInitScript(Application::APP_ID, 'contacts-files-action'); | ||
} else { | ||
Util::addScript(Application::APP_ID, 'contacts-files-action'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Util::addScript(Application::APP_ID, 'contacts-files-action'); | |
Util::addScript(Application::APP_ID, 'contacts-files-action', 'files'); |
} | ||
console.error('Unable to register vcf import action') | ||
}) | ||
if (nextcloudVersionIsGreaterThanOr28) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not even sure this is needed. Worse case this will register an unused action 🤷
id: name, | ||
displayName: () => t('contacts', 'Import'), | ||
default: DefaultType.DEFAULT, | ||
mime, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FileAction doesn't have a mime
default: DefaultType.DEFAULT, | ||
mime, | ||
enabled: (nodes) => { | ||
return nodes.every((node) => node.mime === mime && (node.permissions & Permission.READ)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using some
with the opposite check is faster as it fill stop at the first false return
Something like
return nodes.every((node) => node.mime === mime && (node.permissions & Permission.READ)) | |
return nodes.some((node) => node.mime !== mime || (node.permissions & Permission.READ) === 0) |
fixes #3621