Skip to content
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

feat: Use ensureKonnectorFolder from cozy-client #964

Merged
merged 1 commit into from
Oct 10, 2023

Conversation

doubleface
Copy link
Contributor

And also update the destination folder id saved in the trigger when
needed.

Upgrade cozy-client to 41.4.1 to be able to update the trigger and to
have ensureKonnectorFolder function.

Checklist

Before merging this PR, the following things must have been done:

  • Faithful integration of the mockups at all screen sizes
  • Tested on iOS
  • Tested on Android
  • Localized in English and French
  • All changes have test coverage
  • Updated README & CHANGELOG, if necessary

konnector,
account
const folder = await models.konnectorFolder.ensureKonnectorFolder(client, {
konnector: { ...konnector, _id: konnector._id },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you spread?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_id attribute is missing in konnector object, which causes the reference to the konnector in the destination folder to be null

I think there is something to fix in harvest when the launcher context is sent

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand:

You do:

      konnector: { ...konnector, _id: konnector._id }

and you say : "_id attribute is missing in konnector object,". But you do: _id: konnector._id so _id is present in the konnector object. If this is not the case, you'll have _id: undefined is it really wanted?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I miss typed. The right code is konnector: { ...konnector, _id: konnector.id } and I fixed it now.

@@ -289,6 +289,27 @@ export default class Launcher {
trigger = triggerResponse.data
result.createdTrigger = trigger
log.debug(`ensureAccountAndTriggerAndJob: created trigger`, trigger)
// @ts-ignore
Copy link
Contributor

@Crash-- Crash-- Oct 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a comment to explain why you need to ignore 🙏 (if you can't fix it right now)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, the message attribute of IOCozyTrigger is kind of a free object. Its content depends on the kind of trigger. But all the konnector trigger (client or node) which have a destination folder will have the .message.folder_to_save attribute.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So let's update the IOCozyTrigger type on Cozy-client 🙏

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@doubleface doubleface force-pushed the feat/cozyClientEnsureKonnectorFolder branch 3 times, most recently from 3db6ae7 to b096cfb Compare October 6, 2023 15:38
@doubleface
Copy link
Contributor Author

@Crash-- Should be updated now

And also update the destination folder id saved in the trigger when
needed.

Upgrade cozy-client to 41.4.1 to be able to update the trigger and to
have ensureKonnectorFolder function.
@doubleface doubleface force-pushed the feat/cozyClientEnsureKonnectorFolder branch from b096cfb to 3051efb Compare October 10, 2023 08:10
@doubleface
Copy link
Contributor Author

Upgraded cozy-client with the updated triggers types and removed some @ts-ignore

@doubleface doubleface merged commit 8eeecdb into master Oct 10, 2023
1 check passed
@doubleface doubleface deleted the feat/cozyClientEnsureKonnectorFolder branch October 10, 2023 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants