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

Add Microsoft calendar syncing #14

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Add Microsoft calendar syncing #14

wants to merge 8 commits into from

Conversation

Flare576
Copy link
Owner

@Flare576 Flare576 commented Dec 6, 2022

This PR includes two primary features:

  1. Add instructions and code to support managing an Office 365 calendar via Microsoft's Graph API
  2. Ability to obfuscate to/from specific calendars.

Adding Office365 support required changing the format of CALENDARS_TO_MERGE into an object-based structure to allow the clientID/Secret/Tenant details to be stored. Additionally, parsing the details and formatting events for different APIs made adding some classes (one for each calendar type) make sense as well.

The PR could have been made smaller by adding the obfuscation feature separately, but it would have required changing many of the same parts of code twice, so I opted to roll it into the same effort.

I am noticing that the oAuth access dies after some time right now, and I'm not sure why (I have to re-approve the app); I'll be investigating that, but for now I think this code is ready to review.

Tests all pass, need to add new tests
Consider refactoring to avoid multiple provider `if` statements
Instead of multiple `if` statements, use Object-Oriented approach
},
start: event.start,
end: event.end,
attendees: GetAttendeeSelf(event, this.address),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does GetAttendeeSelf still work in Microsoft? It was finding a specific attendee object on the attendee array (self) which contained the key:value self: true.

Copy link
Owner Author

@Flare576 Flare576 Dec 6, 2022

Choose a reason for hiding this comment

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

Ah, thanks for pointing this out - it doesn't look like the payload from MS provides any "self" indicator, but each attendee is a full object:

                {
                    "type": "required",
                    "status": {
                        "response": "accepted",
                        "time": "0001-01-01T00:00:00Z"
                    },
                    "emailAddress": {
                        "name": "Jeremy Scherer",
                        "address": "[email protected]"
                    }
                },

so maybe a new class function instead of a "static" function since it'll be implementation dependent

@Flare576 Flare576 force-pushed the add-microsoft branch 2 times, most recently from 0849692 to d1b770a Compare December 7, 2022 15:39
@Flare576 Flare576 marked this pull request as ready for review December 7, 2022 23:37
reminderMinutesBeforeStart: 0,
body: {
contentType: 'text',
content: this.obfuscateTo || !INCLUDE_DESC() ? DESC_NOT_COPIED_MSG : event,
Copy link
Owner Author

Choose a reason for hiding this comment

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

Suggested change
content: this.obfuscateTo || !INCLUDE_DESC() ? DESC_NOT_COPIED_MSG : event,
content: this.obfuscateTo || !INCLUDE_DESC() ? DESC_NOT_COPIED_MSG : event.description,

useDefault: false,
overrides: [], // No reminders
},
description: this.obfuscateTo || !INCLUDE_DESC() ? DESC_NOT_COPIED_MSG : event,
Copy link
Owner Author

Choose a reason for hiding this comment

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

Suggested change
description: this.obfuscateTo || !INCLUDE_DESC() ? DESC_NOT_COPIED_MSG : event,
description: this.obfuscateTo || !INCLUDE_DESC() ? DESC_NOT_COPIED_MSG : event.description,

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