Skip to content

fix: Organization Signup when the username is already taken by someone else outside the organization#13506

Merged
PeerRich merged 2 commits intomainfrom
fix-signup
Feb 2, 2024
Merged

fix: Organization Signup when the username is already taken by someone else outside the organization#13506
PeerRich merged 2 commits intomainfrom
fix-signup

Conversation

@hariombalhara
Copy link
Copy Markdown
Member

@hariombalhara hariombalhara commented Feb 2, 2024

What does this PR do?

Fixes #13508

Type of change

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

How should this be tested?

  • Create an org Org1(@org1.com)
  • Invite teampro@org1.com
  • Observe the error during signup. It happens because teampro is already taken outside the organization.
    • After the fix, user should be allowed to signup.

Mandatory Tasks

  • Make sure you have self-reviewed the code. A decent size PR without self-review might be rejected.

Checklist

  • I haven't added tests that prove my fix is effective or that my feature works

@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 2, 2024

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

Name Status Preview Comments Updated (UTC)
api ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 2, 2024 3:11pm
6 Ignored Deployments
Name Status Preview Comments Updated (UTC)
ai ⬜️ Ignored (Inspect) Visit Preview Feb 2, 2024 3:11pm
cal ⬜️ Ignored (Inspect) Visit Preview Feb 2, 2024 3:11pm
cal-demo ⬜️ Ignored (Inspect) Visit Preview Feb 2, 2024 3:11pm
calcom-web-canary ⬜️ Ignored (Inspect) Visit Preview Feb 2, 2024 3:11pm
qa ⬜️ Ignored (Inspect) Visit Preview Feb 2, 2024 3:11pm
ui ⬜️ Ignored (Inspect) Visit Preview Feb 2, 2024 3:11pm

@hariombalhara
Copy link
Copy Markdown
Member Author

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 2, 2024

Thank you for following the naming conventions! 🙏 Feel free to join our discord and post your PR link.

@keithwillcode keithwillcode added consumer core area: core, team members only labels Feb 2, 2024
@hariombalhara hariombalhara changed the title Correcly identify the user during signup fix: Organization Signup when the username is already taken by someone else outside the organization Feb 2, 2024
@hariombalhara hariombalhara added the High priority Created by Linear-GitHub Sync label Feb 2, 2024
@github-actions github-actions Bot added organizations area: organizations, orgs 🐛 bug Something isn't working labels Feb 2, 2024
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 2, 2024

📦 Next.js Bundle Analysis for @calcom/web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

Comment on lines +119 to +157
where: {
username,
// Simply remove it when we drop organizationId column
organizationId: null,
},
select: {
id: true,
username: true,
},
});

if (user) {
response.available = false;
}

if (await isPremiumUserName(username)) {
response.premium = true;
}

// get list of similar usernames in the db
const users = await prisma.user.findMany({
where: {
username: {
contains: username,
},
},
select: {
username: true,
},
});

// We only need suggestedUsername if the username is not available
if (!response.available) {
response.suggestedUsername = await generateUsernameSuggestion(
users.map((user) => user.username).filter(notEmpty),
username
);
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Reverted usernameCheck back to it's previous state and introduced usernameCheckForSignup for the signup specific use case where an already created user is being allowed to signup so that he can set his password. Note that the user is created as soon as he is invited.

@hariombalhara hariombalhara marked this pull request as ready for review February 2, 2024 12:01
@hariombalhara hariombalhara requested a review from a team February 2, 2024 12:02
Copy link
Copy Markdown
Contributor

@emrysal emrysal left a comment

Choose a reason for hiding this comment

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

Looking good to me :)

@deploysentinel
Copy link
Copy Markdown

deploysentinel Bot commented Feb 2, 2024

Current Playwright Test Results Summary

✅ 439 Passing - ⚠️ 22 Flaky

Run may still be in progress, this comment will be updated as current testing workflow or job completes...

(Last updated on 02/02/2024 03:15:56pm UTC)

Run Details

Running Workflow PR Update on Github Actions

Commit: 1a92d66

Started: 02/02/2024 03:05:36pm UTC

⚠️ Flakes

📄   apps/web/playwright/booking/longTextQuestion.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Booking With Long Text Question and Each Other Question Booking With Long Text Question and checkbox Question Long Text and checkbox required
Retry 1Initial Attempt
0% (0) 0 / 228 runs
failed over last 7 days
2.63% (6) 6 / 228 runs
flaked over last 7 days

📄   apps/web/playwright/booking/selectQuestion.e2e.ts • 2 Flakes

Top 1 Common Error Messages

null

2 Test Cases Affected

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Booking With Phone Question and Each Other Question Booking With Select Question and checkbox group Question Select required and checkbox group required
Retry 1Initial Attempt
0% (0) 0 / 216 runs
failed over last 7 days
3.70% (8) 8 / 216 runs
flaked over last 7 days
Booking With Phone Question and Each Other Question Booking With Select Question and Multi email Question Select and Multi email not required
Retry 1Initial Attempt
0% (0) 0 / 213 runs
failed over last 7 days
1.88% (4) 4 / 213 runs
flaked over last 7 days

📄   apps/web/playwright/booking/checkboxGroupQuestion.e2e.ts • 3 Flakes

Top 1 Common Error Messages

null

3 Test Cases Affected

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Booking With Checkbox Group Question and Each Other Question Booking With Checkbox Group Question and Address Question Booking With Checkbox Group Question and multiselect Question Checkbox Group required and multiselect text required
Retry 1Initial Attempt
0% (0) 0 / 234 runs
failed over last 7 days
5.56% (13) 13 / 234 runs
flaked over last 7 days
Booking With Checkbox Group Question and Each Other Question Booking With Checkbox Group Question and Address Question Booking With Checkbox Group Question and Number Question Checkbox Group and Number not required
Retry 1Initial Attempt
1.28% (3) 3 / 234 runs
failed over last 7 days
3.42% (8) 8 / 234 runs
flaked over last 7 days
Booking With Checkbox Group Question and Each Other Question Booking With Checkbox Group Question and Address Question Booking With Checkbox Group Question and select Question Checkbox Group required and select required
Retry 1Initial Attempt
0.87% (2) 2 / 231 runs
failed over last 7 days
6.49% (15) 15 / 231 runs
flaked over last 7 days

📄   apps/web/playwright/booking/radioGroupQuestion.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Booking With Radio Question and Each Other Question Booking With Radio Question and Address Question Booking With Radio Question and Number Question Radio and Number not required
Retry 1Initial Attempt
0.45% (1) 1 / 223 run
failed over last 7 days
4.04% (9) 9 / 223 runs
flaked over last 7 days

📄   apps/web/playwright/insights.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Insights should be able to switch between memberUsers
Retry 1Initial Attempt
0.44% (1) 1 / 228 run
failed over last 7 days
0.44% (1) 1 / 228 run
flaked over last 7 days

📄   apps/web/playwright/booking/addressQuestione2e/addressQuestion.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Booking With Address Question and Each Other Question Booking With Address Question and Multi email Question Address and Multi email not required
Retry 1Initial Attempt
0% (0) 0 / 240 runs
failed over last 7 days
4.17% (10) 10 / 240 runs
flaked over last 7 days

📄   apps/web/playwright/signup.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Signup Flow Test Signup with valid (non premium) username
Retry 1Initial Attempt
1.21% (3) 3 / 247 runs
failed over last 7 days
4.05% (10) 10 / 247 runs
flaked over last 7 days

📄   apps/web/playwright/booking/multipleEmailQuestion.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Booking With Multiple Email Question and Each Other Question Booking With Multiple Email Question and Long text Question Multiple Email required and Long text required
Retry 1Initial Attempt
0.43% (1) 1 / 235 run
failed over last 7 days
4.68% (11) 11 / 235 runs
flaked over last 7 days

📄   packages/embeds/embed-core/playwright/tests/action-based.e2e.ts • 8 Flakes

Top 1 Common Error Messages

null

8 Test Cases Affected

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Popup Tests should open embed iframe on click - Configured with light theme
Retry 1Initial Attempt
-2.87% (-7) -7 / 244 runs
failed over last 7 days
45.49% (111) 111 / 244 runs
flaked over last 7 days
Popup Tests should be able to reschedule
Retry 1Initial Attempt
-79.86% (-111) -111 / 139 runs
failed over last 7 days
79.86% (111) 111 / 139 runs
flaked over last 7 days
Popup Tests should open Routing Forms embed on click
Retry 1Initial Attempt
-69.78% (-97) -97 / 139 runs
failed over last 7 days
72.66% (101) 101 / 139 runs
flaked over last 7 days
Popup Tests Floating Button Popup Pro User - Configured in App with default setting of system theme should open embed iframe according to system theme when no theme is configured through Embed API
Retry 1Initial Attempt
-74.81% (-101) -101 / 135 runs
failed over last 7 days
74.81% (101) 101 / 135 runs
flaked over last 7 days
Popup Tests Floating Button Popup Pro User - Configured in App with default setting of system theme should open embed iframe according to system theme when configured with 'auto' theme using Embed API
Retry 1Initial Attempt
-74.81% (-101) -101 / 135 runs
failed over last 7 days
74.81% (101) 101 / 135 runs
flaked over last 7 days
Popup Tests Floating Button Popup Pro User - Configured in App with default setting of system theme should open embed iframe(Booker Profile Page) with dark theme when configured with dark theme using Embed API
Retry 1Initial Attempt
-74.81% (-101) -101 / 135 runs
failed over last 7 days
74.81% (101) 101 / 135 runs
flaked over last 7 days
Popup Tests Floating Button Popup Pro User - Configured in App with default setting of system theme should open embed iframe(Event Booking Page) with dark theme when configured with dark theme using Embed API
Retry 1Initial Attempt
-74.07% (-100) -100 / 135 runs
failed over last 7 days
74.07% (100) 100 / 135 runs
flaked over last 7 days
Popup Tests prendered embed should be loaded and apply the config given to it
Retry 1Initial Attempt
-74.07% (-100) -100 / 135 runs
failed over last 7 days
74.07% (100) 100 / 135 runs
flaked over last 7 days

📄   apps/web/playwright/embed-code-generator.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Embed Code Generator Tests Non-Organization Event Types Page open Embed Dialog and choose element-click for First Event Type
Retry 1Initial Attempt
0.41% (1) 1 / 245 run
failed over last 7 days
7.35% (18) 18 / 245 runs
flaked over last 7 days

📄   apps/web/playwright/organization/organization-invitation.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Organization Email matching orgAutoAcceptEmail and a Verified Organization Team Invitation
Retry 1Initial Attempt
1.75% (4) 4 / 229 runs
failed over last 7 days
13.10% (30) 30 / 229 runs
flaked over last 7 days

📄   apps/web/playwright/organization/across-org/across-org.e2e.ts • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
user1NotMemberOfOrg1 is part of team1MemberOfOrg1 Team1 profile should show correct domain if logged in as User1
Retry 1Initial Attempt
0% (0) 0 / 234 runs
failed over last 7 days
1.71% (4) 4 / 234 runs
flaked over last 7 days

View Detailed Build Results


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛 bug Something isn't working consumer core area: core, team members only High priority Created by Linear-GitHub Sync organizations area: organizations, orgs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CAL-3072] Error during signup through invite for organization

5 participants