-
Notifications
You must be signed in to change notification settings - Fork 13
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
[VO-711] feat: Add a collection to access files into a Nextcloud #1471
Conversation
To use the enabled option, the definition is passed in the form of a general function. I've adapted the typing to this practice. This allows me to display the warning also for definition passed with a function
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.
Some questions about the returned data, but looks good!
path: `${path}${path.endsWith('/') ? '' : '/'}${file.attributes.name}`, | ||
cozyMetadata: { | ||
...file.attributes.cozyMetadata, | ||
sourceAccount |
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.
Why do we have to manually set the sourceAccount
? I feel like this should be up to the client to set it, just like the other cozyMetadata
attributes?
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.
This is for convenience, because in order to use all the routes in the stack we need to have the Nextcloud path and sourceAccount pair. This is only present in the shortcut describing the Nextcloud. To reuse the same action as the io.cozy.files, I've introduced it into the file so that you only have to pass a file as a parameter as expected
@@ -51,7 +51,7 @@ const useQuery = (queryDefinition, options) => { | |||
|
|||
const client = useClient() | |||
const queryState = useSelector(() => { | |||
if (options.singleDocData === undefined && queryDefinition.id) { | |||
if (options.singleDocData === undefined && definition?.id) { |
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.
Good catch!
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.
Thanks to typing, yet another example, even with JSDoc
const normalizeNextcloudFile = (sourceAccount, path) => file => { | ||
const extendedAttributes = { | ||
...file.attributes, | ||
path: `${path}${path.endsWith('/') ? '' : '/'}${file.attributes.name}`, |
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.
The stack does not return the path like the other files?
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.
Nop, but maybe she could do it
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 feel like it should for consistency, @nono what do you think?
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.
Well, it makes the response bigger, and they are quite easy to compute client-side, so I decided to not include them.
This PR is the first one to implement the new type
io.cozy.remote.nextcloud.files
. It allow us to interact with Nextcloud server inside Drive 🙂Related PRs :