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

Update existing events instead of replacing them #15

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

luhuhis
Copy link

@luhuhis luhuhis commented May 28, 2022

This does what I've described in issue #14

@bartier
Copy link

bartier commented Jul 18, 2022

Why this is not reviewed yet? This is such a important feature. +1 to this.

@mmurshed
Copy link

+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}`,

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}`,

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];

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.`);

Choose a reason for hiding this comment

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

Typo ${action}d.

@mmurshed
Copy link

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 = ""

Choose a reason for hiding this comment

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

Remove this.

@luhuhis
Copy link
Author

luhuhis commented Aug 17, 2022

I will fix the issues you found as soon as I find some time! Thanks for reviewing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants