Skip to content
This repository has been archived by the owner on Jun 9, 2023. It is now read-only.

feat: integration info during event creation #2292

Closed

Conversation

gikf
Copy link
Member

@gikf gikf commented Jan 27, 2023

  • I have read Chapter's contributing guidelines.
  • My pull request has a descriptive title (not a vague title like Update README.md).
  • My pull request targets the main branch of Chapter.

  • Adds information about integration status and creation of the event in the chapter's calendar.
  • Changing query to dashboardChapter was needed to get the has_calendar.

@gikf gikf added UI/UX This issue deals with UI/UX status: ready for review labels Jan 27, 2023
@gikf gikf requested a review from a team January 27, 2023 13:25
@ghost
Copy link

ghost commented Jan 27, 2023

👇 Click on the image for a new way to code review
  • Make big changes easier — review code in small groups of related files

  • Know where to start — see the whole change at a glance

  • Take a code tour — explore the change with an interactive tour

  • Make comments and review — all fully sync’ed with github

    Try it now!

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map Legend

Copy link
Contributor

@ojeytonwilliams ojeytonwilliams left a comment

Choose a reason for hiding this comment

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

It's probably a better UX to provide the authenticate + create calendar buttons on the event page, but that's a little out of scope!

I think we can improve the warnings a little, though:

Comment on lines +45 to +48
return {
Icon: InfoIcon,
text: 'Instance is authenticated with calendar api, and chapter has created calendar. Chapter will attempt creating event in the calendar.',
};
Copy link
Contributor

Choose a reason for hiding this comment

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

It doesn't seem necessary to warn people that things are going to work as expected

Copy link
Member Author

@gikf gikf Feb 5, 2023

Choose a reason for hiding this comment

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

I wanted to include it as a part if something goes wrong, as there isn't clear path to inform client when creating calendar event errors.

This got me thinking, what if creating calendar and calendar event is pulled out of the create chapter/event resolvers? The actual creation can be then run once entry is created. That gives ability to separate and inform about errors on both these steps:

  1. Create chapter/event. In case of errors, stop and inform client. Otherwise go to next step.
  2. From client run mutation creating calendar/ calendar event. Errors can be clearly indicated as coming from calendar integration. They could be also displayed as warnings.

Edit: Or keep it in resolver and just check in object returned by mutation 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

I like the sound of that.

Potentially the Google Event creation could fail in a bunch of ways (lack of permissions, rate limits, network error, bad configuration etc. etc.), so rather than trying to warn organisers that the Event will not get created we should focus on handling the errors when it inevitably does fail. Particularly since there are no checks we can carry out that will guarantee that an Event will be created - only that it has been.

Even if the owner has forgotten to authenticate with Google, it should only be a problem for the first event. After which they'll see the warning, authenticate and create the calendar event (once that's implemented).

What do you reckon?

Copy link
Member Author

Choose a reason for hiding this comment

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

That seems to be better way of handling it. I'll block this PR for now, start with simple informing if calendar/event in calendar was created, and see how to go from there.

Copy link
Contributor

Choose a reason for hiding this comment

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

Cool, that sounds like the way to go.

}
return {
Icon: WarningTwoIcon,
text: "Instance is authenticated with calendar api, but chapter doesn't have calendar created. Event will not be created in the calendar.",
Copy link
Contributor

Choose a reason for hiding this comment

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

How about the following?

"This chapter does not have a calendar. To allow calendar event creation, go to link-to-chapter and create a calendar"

Comment on lines +56 to +72
const isBroken = isAuthenticated === null;
if (isBroken) {
if (hasCalendar) {
return {
Icon: WarningTwoIcon,
text: 'Chapter has calendar created, but calendar integration is not working. Event will not be created in the calendar.',
};
}
return {
Icon: WarningTwoIcon,
text: 'Calendar integration is not working, and chapter does not have calendar created. Event will not be created in calendar.',
};
}
return {
Icon: WarningTwoIcon,
text: 'Instance is not authenticated with calendar api. Automatic creation of events in calendar is not possible.',
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to distinguish between these three cases? I think it makes sense to handle hasCalendar separately, but if Chapter's tokens are missing or invalid, the fix is simply to reauthenticate.

With that in mind, how about this

Chapter is not authenticated with Google Calendar. Go to link to calendar dash to authenticate.

Chapter is not authenticated with Google Calendar and this chapter does not have a calendar. Go to link to calendar dash to authenticate. If you wish to create a calendar, visit the chapter dashboard.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm a bit assuming that person seeing these warnings not necessarily has privileges to (re-)authenticate. Otherwise the alert on the top would be catching the attention to re-authenticate.

@ojeytonwilliams
Copy link
Contributor

Since we never quite resolved this one, I'll have to close it.

@gikf gikf deleted the feat/integration-info-event-create branch June 13, 2023 09:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: blocked UI/UX This issue deals with UI/UX
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants