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

Fix CalDAV update if sync is set #1703

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ async function syncUserCalendars(userId) {

// Else update it if sync is enable on calendar & events change
if (gladysCalendar[0].sync && formatedCalendar.ctag !== gladysCalendar[0].ctag) {
await this.gladys.calendar.update(gladysCalendar[0].selector, formatedCalendar);
await this.gladys.calendar.update(gladysCalendar[0].selector, {
...formatedCalendar,
sync: gladysCalendar[0].sync,
Copy link
Contributor

@Pierre-Gilles Pierre-Gilles Feb 3, 2023

Choose a reason for hiding this comment

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

Don't you risk to still update it wrongly if it changed between the .get and the .update ?

Why not simply removing the sync attribute from the update if it's not required?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is no action between get and update, so time is really, really short, I don't think change can happen. But indeed delete is a better option, more readable I changed.

});
return gladysCalendar[0];
}
return null;
Expand Down