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

Do not sync events if the user declined an event invitation #45

Closed
alxndr13 opened this issue Jul 17, 2023 · 5 comments
Closed

Do not sync events if the user declined an event invitation #45

alxndr13 opened this issue Jul 17, 2023 · 5 comments

Comments

@alxndr13
Copy link
Contributor

If a user declines an event invitation in his source calendar, the event still gets synced to the sink calendar. We should make it optional to sync these events.

@FlorianWilhelm
Copy link

Thanks! This would be an awesome feature :-)

@alxndr13
Copy link
Contributor Author

@MichaelEischer i just fiddled around a bit and i wanted to document my findings..

On Outlook, this seems to be relatively easy, as the Outlook Event provides a responsestatus resource as part of the event resource.

On Google it is a bit trickier, there are two fields which i thought would play a role here:

  • status
  • attendees[].responseStatus

Status only reflects the event organizers state. Which means if the organizer has not cancelled the event, the status will always be confirmed and the field does not have anything to do with the response of the user..

But the attendees field would be the one we search for. We would need to check if one of the attendees has the field self set to true (how can we check that this is us?) and if we declined the event, we will not sync it.

Some test code in the google adapter (in ListEvents):

	for _, event := range eventList.Items {
		var declinedBuffer bool = false
		for _, v := range event.Attendees {
			if v.Self == true && v.ResponseStatus == "declined" {
				fmt.Println("we declined the event, remove it")
				declinedBuffer = true
			}
		}
		if declinedBuffer {
			declinedBuffer = false
			continue
		}
		loadedEvents = append(loadedEvents, calendarEventToEvent(event, g.GetSourceID()))
	}

Instead of filtering in the adapters, we could simply add a new field to models.Event, populate it in the adapters and remove the event from the list of to be synced events in the synchronization process. (i actually find this the better option).

But as i'm out of time today, i'll have a look at this on another day.

@MichaelEischer
Copy link
Collaborator

Instead of filtering in the adapters, we could simply add a new field to models.Event, populate it in the adapters and remove the event from the list of to be synced events in the synchronization process. (i actually find this the better option).

If we only ever use a Declined field to remove events, then directly removing the event would also be fine. I'm wondering whether a synced event in a sink calendar could end up as declined, in which case the event shouldn't be filtered out automatically. It looks like the answer is no, at least for google calendars.

@alxndr13
Copy link
Contributor Author

Worked on this in: #62

works for google and outlook, did not look into zep (we should consider deprecating this adapter as nobody uses it anyways 😂 )

@MichaelEischer
Copy link
Collaborator

#62 has been merged by now.

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

No branches or pull requests

3 participants