-
Notifications
You must be signed in to change notification settings - Fork 39
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
Update existing events instead of replacing them #15
base: main
Are you sure you want to change the base?
Conversation
Why this is not reviewed yet? This is such a important feature. +1 to this. |
+1 on this. Please add a co-mainter for this project. |
method: 'PUT', | ||
endpoint: `${ENDPOINT_BASE}/${CALENDAR_TO_MERGE_INTO}/events/${target_event.id}`, | ||
requestBody: { | ||
summary: `${SEARCH_CHARACTER}${source_event.summary} ${calendarName}`, |
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.
Can you please move this prefix calendarName to the beginning like the main code does?
method: 'POST', | ||
endpoint: `${ENDPOINT_BASE}/${CALENDAR_TO_MERGE_INTO}/events`, | ||
requestBody: { | ||
summary: `${SEARCH_CHARACTER}${source_event.summary} ${calendarName}`, |
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.
If the PUT call create a calendar with name "Test [Work]", will the POST for update it to "Test [Work] [Work]"? Looks like a bug.
// Only consider events that are not "free". | ||
if (source_event.transparency !== 'transparent') { | ||
|
||
const target_event = target_events.filter((candidate_event) => (candidate_event.iCalUID == source_event.iCalUID))[0]; |
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.
Should it be candidate_event.iCalUID === source_event.iCalUID
? What if candidate_event is null?
@@ -72,69 +48,97 @@ function deleteEvents(startTime, endTime) { | |||
console.log(result); | |||
} | |||
|
|||
console.log(`${result.length} deleted events.`); | |||
console.log(`${result.length} events ${action}d.`); |
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.
Typo ${action}d
.
We also need a force delete option. |
// check if target event exists and update it if it does. if not, then create it. | ||
requestBody_update = [] | ||
requestBody_create = [] | ||
let new_description = "" |
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.
Remove this.
I will fix the issues you found as soon as I find some time! Thanks for reviewing. |
This does what I've described in issue #14