Skip to content

Bugfix: Google signup issues#883

Merged
sausage-todd merged 2 commits intomainfrom
bugfix/google-signup
May 19, 2023
Merged

Bugfix: Google signup issues#883
sausage-todd merged 2 commits intomainfrom
bugfix/google-signup

Conversation

@sausage-todd
Copy link
Copy Markdown
Contributor

@sausage-todd sausage-todd commented May 18, 2023

Changes proposed ✍️

What

Fixes two issues with signing up with a google account:

  1. If a user tries to accept an invitation to a workspace using a google signup, they see a 403 page. This happens because when a user is created by a callback from google, we don't accept the original invitation, and the invited tenantUser remains in a invited state, cause all /api/tenant/:tenantId/... requests end up with 403.
  2. If a user signs up with google without any invitation, they get redirected to /onboard page, but with lots of error toasts in the bottom right corner. This happens because when a google signup redirects the user back to the app, they're redirected to the root page /, which tries to render the dashboard. And since the user doesn't have a connected workspace yet, all the requests made by the dashboard trying to render itself (such as /api/tenant/:tenantId/activity/query or /api/tenant/:tenantId/conversation/query) fail because with empty tenantId they look like /api/tenant/null/activity/query. Eventually the frontend figures out that there is no tenantId and redirects the user to /onboard page, but the dashboard already tried to render and made all those XHR requests.

Copilot summary

🤖 Generated by Copilot at 2ee2bd2

Added social onboarding feature for email and password users and improved dashboard data rendering based on current project or organization. Updated main.js to import and use AuthService module and added currentTenant property to dashboard-page.vue.

Copilot poem

🤖 Generated by Copilot at 2ee2bd2

We are the social onboarding rebels
We break the chains of AuthService
We choose our own currentTenant
We rule the dashboard of our destiny

Why

Because these are bugs

How

  1. When getting redirected after the google signup, we now also make a call to /api/auth/social/onboard endpoint, which takes { invitationToken, tenantId } and accepts the invitation changing status of tenantUser to active. This call used to be done by the frontend at some point, but was removed as part of Vue 3 migration PR.
  2. We don't render the dashboard page if we don't have a tenant id

Copilot walkthrough

🤖 Generated by Copilot at 2ee2bd2

  • Import and use AuthService module to handle social onboarding requests in main.js (link, link)
  • Add and use currentTenant property to render and fetch dashboard data only when tenant data is available in dashboard-page.vue (link, link)

Videos

Signing up with google via invitation before the fix
invited-google-signup-before.mp4
Clean google signup before the fix
clean-google-signup-before.mp4
Signing up with google via invitation after the fix
invited-google-signup-after.mp4
Clean google signup after the fix
clean-google-signup-after.mp4

Checklist ✅

  • Label appropriately with Feature, Improvement, or Bug.
  • Add screehshots to the PR description for relevant FE changes
  • New backend functionality has been unit-tested.
  • API documentation has been updated (if necessary) (see docs on API documentation).
  • Quality standards are met.

Misha Savelyev added 2 commits May 18, 2023 12:32
- It was previously here, but got probably got lost during migration
  into newer version of Vue
- Without this an invited user doesn't get their invitation accepted
  when they signup with a social account
@sausage-todd sausage-todd added the Bug Created by Linear-GitHub Sync label May 18, 2023
@sausage-todd
Copy link
Copy Markdown
Contributor Author

Added videos explaining buggy and fixed behavior

@joanreyero joanreyero removed their request for review May 19, 2023 08:32
@sausage-todd sausage-todd merged commit f734cd9 into main May 19, 2023
@sausage-todd sausage-todd deleted the bugfix/google-signup branch May 19, 2023 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Created by Linear-GitHub Sync

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants