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

fix: Add the 'cal-video' location only if it doesn't already exist #15038

Merged
merged 3 commits into from
May 17, 2024

Conversation

SomayChauhan
Copy link
Member

@SomayChauhan SomayChauhan commented May 15, 2024

What does this PR do?

Removing a conferencing app adds 'cal video' option to the location dropdown, even if it already exist.

Before
LOOM

After
LOOM

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected)
  • I have added a Docs issue here if this PR makes changes that would require a documentation change
  • I have added or modified automated tests that prove my fix is effective or that my feature works (PRs might be rejected if logical changes are not properly tested)

How should this be tested?

checkout loom

@graphite-app graphite-app bot requested a review from a team May 15, 2024 05:45
Copy link
Contributor

github-actions bot commented May 15, 2024

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

@keithwillcode keithwillcode added the core area: core, team members only label May 15, 2024
@dosubot dosubot bot added cal video 🐛 bug Something isn't working labels May 15, 2024
Copy link

graphite-app bot commented May 15, 2024

Graphite Automations

"Add consumer team as reviewer" took an action on this PR • (05/15/24)

1 reviewer was added to this PR based on Keith Williams's automation.

Copy link
Contributor

github-actions bot commented May 15, 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! 🙌

Copy link

deploysentinel bot commented May 15, 2024

Current Playwright Test Results Summary

✅ 34 Passing - ⚠️ 1 Flaky

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

(Last updated on 05/17/2024 09:13:05am UTC)

Run Details

Running Workflow PR Update on Github Actions

Commit: 900bb32

Started: 05/17/2024 09:12:19am UTC

⚠️ Flakes

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

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Update Profile Can verify the newly added secondary email
Retry 1Initial Attempt
2.44% (6) 6 / 246 runs
failed over last 7 days
24.39% (60) 60 / 246 runs
flaked over last 7 days

View Detailed Build Results


Copy link

vercel bot commented May 15, 2024

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

Name Status Preview Comments Updated (UTC)
ai ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 17, 2024 7:40am
2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
cal ⬜️ Ignored (Inspect) Visit Preview May 17, 2024 7:40am
calcom-web-canary ⬜️ Ignored (Inspect) Visit Preview May 17, 2024 7:40am

Comment on lines +102 to +129
const integrationQuery = getRemovedIntegrationNameFromAppSlug(credential.app?.slug ?? "");

// Check if the event type uses the deleted integration

// To avoid type errors, need to stringify and parse JSON to use array methods
const locations = locationsSchema.parse(eventType.locations);

const doesDailyVideoAlreadyExists = locations.some((location) =>
location.type.includes(DailyLocationType)
);

const updatedLocations: TlocationsSchema = locations.reduce((acc: TlocationsSchema, location) => {
if (location.type.includes(integrationQuery)) {
if (!doesDailyVideoAlreadyExists) acc.push({ type: DailyLocationType });
} else {
acc.push(location);
}
return acc;
}, []);

await prisma.eventType.update({
where: {
id: eventType.id,
},
data: {
locations: updatedLocations,
},
});
Copy link
Contributor

Choose a reason for hiding this comment

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

You code worked fine but it wasn't easily readable/maintainable so i pushed these changes. (Nothing major just extracted logic to some functions and reduced nested conditionals and changed variable names)

Copy link
Contributor

Choose a reason for hiding this comment

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

Do let me know if you find anything wrong

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you!!!!, looks good 👍

Copy link

linear bot commented May 17, 2024

@github-actions github-actions bot added the Medium priority Created by Linear-GitHub Sync label May 17, 2024
@Udit-takkar Udit-takkar enabled auto-merge (squash) May 17, 2024 07:37
@Udit-takkar Udit-takkar merged commit e723b98 into main May 17, 2024
41 checks passed
@Udit-takkar Udit-takkar deleted the add-cal-video-if-not-exists branch May 17, 2024 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working cal video core area: core, team members only Medium priority Created by Linear-GitHub Sync
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CAL-3751] [BUG] Add the 'cal-video' location only if it doesn't already exist
3 participants