Skip to content

Calendar credential key missing fix#4645

Merged
PeerRich merged 3 commits intomainfrom
fix/invalid-calendar-credential-key
Sep 21, 2022
Merged

Calendar credential key missing fix#4645
PeerRich merged 3 commits intomainfrom
fix/invalid-calendar-credential-key

Conversation

@leog
Copy link
Copy Markdown
Contributor

@leog leog commented Sep 21, 2022

What does this PR do?

For some reason we lost the warning that let the users know if there was any connected calendar without the correct permissions given.

How it looked before the fix:

How it looks now with the fix for one connected calendar:

How it looks now with the fix for two connected calendar (one failing):

Fixes #4641

Environment: Staging(main branch) / Production

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How should this be tested?

Go to Apps and connect a Google Calendar. When providing permission don't check the following checkboxes and click the "Continue" button.

@vercel
Copy link
Copy Markdown

vercel bot commented Sep 21, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
cal ✅ Ready (Inspect) Visit Preview Sep 21, 2022 at 1:08PM (UTC)

@leog leog requested a review from a team September 21, 2022 07:33
@leog leog self-assigned this Sep 21, 2022
@leog leog added this to the Hotfix milestone Sep 21, 2022
}
return (
<List className="flex flex-col gap-6">
<List className="flex flex-col gap-6" noBorderTreatment>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Had to make the list without borders as they were messing up each calendar integration list item, specifically the warning itself.

message={item.error?.message}
title={t("something_went_wrong")}
message={t("calendar_error")}
iconClassName="h-10 w-10 ml-2 mr-1 mt-0.5"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Made the icon the same size and position as the rest of the icons in the calendar integration list

iconClassName="h-10 w-10 ml-2 mr-1 mt-0.5"
actions={
<div className="w-32">
<div className="flex w-32 justify-end">
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Disconnect icon at the very end as the other integrations


key = token.res?.data;

if (!key) res.status(401).json({ message: "Permissions not granted" });
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We have already covered this scenario afterwards in the workflow. This result in the API was throwing a bare bones JSON when clicking "Cancel" in Google Calendar permission flow, not a very good UX.

if (!primary) {
throw new Error("No primary calendar found");
}
if (!calendar) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Replacing the try/catch with the proper short-circuit return value that enables showing the warning without needing to catch an error or even showing it.

}
export function Alert(props: AlertProps) {
const { severity } = props;
const { severity, iconClassName } = props;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

To be able to style the icon in the alert as I needed for the calendar list

className={classNames(
"divide-y divide-neutral-200 rounded-md border border-l border-r sm:mx-0 sm:overflow-hidden",
"sm:mx-0 sm:overflow-hidden",
!noBorderTreatment && "divide-y divide-neutral-200 rounded-md border border-l border-r ",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

no border option, thank God!

@leog leog marked this pull request as draft September 21, 2022 07:41
@leog
Copy link
Copy Markdown
Contributor Author

leog commented Sep 21, 2022

Found a small misalignment issue, converted to draft to tackle it before it can be merged.

@joeauyeung
Copy link
Copy Markdown
Contributor

Before merging we should also make sure this displays on the settings calendar page as well.

@leog
Copy link
Copy Markdown
Contributor Author

leog commented Sep 21, 2022

Took the opportunity to improve the mobile experience aside from the needed type fix.

From this:

To this:

@leog leog marked this pull request as ready for review September 21, 2022 12:02
@hariombalhara
Copy link
Copy Markdown
Member

@leog Can this be fixed along with it ? #3204

@PeerRich PeerRich enabled auto-merge (squash) September 21, 2022 12:45
@hariombalhara
Copy link
Copy Markdown
Member

Turns out it was quick to do. I have made the changes and this is how it should look. @Jaibles for design on showing a link in the alert
Screenshot 2022-09-21 at 6 37 21 PM

I picture the ideal flow should be that when user clicks delete button(which should be changed to a reconnect icon), the app should be uninstalled the same way it is currently and user should be redirected to App installation page to reinstall it(preferably directly to the URL that is behind Install button)
This would make the entire reconnect flow smooth

@PeerRich PeerRich merged commit e2747f8 into main Sep 21, 2022
@PeerRich PeerRich deleted the fix/invalid-calendar-credential-key branch September 21, 2022 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

better error when not all google calendar

4 participants