-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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 default schedule while creating org member #16855
Merged
anikdhabal
merged 15 commits into
calcom:main
from
vijayraghav-io:fix_16853_addAutoAcceptedInvite
Nov 18, 2024
Merged
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
3754733
add default schedule while creating org user
vijayraghav-io 6687000
naming as per review comments
vijayraghav-io 7990f0c
Merge branch 'main' of https://github.com/calcom/cal.com into fix_168…
vijayraghav-io f04ec7e
Merge branch 'main' of https://github.com/calcom/cal.com into fix_168…
vijayraghav-io 8022fae
added e2e test
vijayraghav-io 31d3dd8
Merge branch 'main' of https://github.com/calcom/cal.com into fix_168…
vijayraghav-io ba402c3
Merge branch 'main' into fix_16853_addAutoAcceptedInvite
anikdhabal 4f8a69e
move bookTeamEvent and expectPageNotFound to testUtils
vijayraghav-io 39f68d2
Merge branch 'main' into fix_16853_addAutoAcceptedInvite
anikdhabal 122ea4f
Update EventTeamAssignmentTab.tsx
anikdhabal 6779c6a
Update AddMembersWithSwitch.tsx
anikdhabal 8ee780b
Update utils.ts
anikdhabal 6f3471e
Merge branch 'main' into fix_16853_addAutoAcceptedInvite
anikdhabal 8127ed1
update
anikdhabal 160ddf7
revert
anikdhabal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ import type { TFunction } from "next-i18next"; | |
|
||
import { getOrgFullOrigin } from "@calcom/ee/organizations/lib/orgDomains"; | ||
import { sendTeamInviteEmail } from "@calcom/emails"; | ||
import { DEFAULT_SCHEDULE, getAvailabilityFromSchedule } from "@calcom/lib/availability"; | ||
import { ENABLE_PROFILE_SWITCHER, WEBAPP_URL } from "@calcom/lib/constants"; | ||
import { createAProfileForAnExistingUser } from "@calcom/lib/createAProfileForAnExistingUser"; | ||
import logger from "@calcom/lib/logger"; | ||
|
@@ -272,6 +273,7 @@ export async function createNewUsersConnectToOrgIfExists({ | |
timeFormat, | ||
weekStart, | ||
timeZone, | ||
language, | ||
}: { | ||
invitations: Invitation[]; | ||
isOrg: boolean; | ||
|
@@ -283,6 +285,7 @@ export async function createNewUsersConnectToOrgIfExists({ | |
timeFormat?: number; | ||
weekStart?: string; | ||
timeZone?: string; | ||
language: string; | ||
}) { | ||
// fail if we have invalid emails | ||
invitations.forEach((invitation) => checkInputEmailIsValid(invitation.usernameOrEmail)); | ||
|
@@ -307,6 +310,8 @@ export async function createNewUsersConnectToOrgIfExists({ | |
|
||
const isBecomingAnOrgMember = parentId || isOrg; | ||
|
||
const availability = getAvailabilityFromSchedule(DEFAULT_SCHEDULE); | ||
const t = await getTranslation(language, "common"); | ||
const createdUser = await tx.user.create({ | ||
data: { | ||
username: isBecomingAnOrgMember ? orgMemberUsername : regularTeamMemberUsername, | ||
|
@@ -340,6 +345,21 @@ export async function createNewUsersConnectToOrgIfExists({ | |
accepted: autoAccept, // If the user is invited to a child team, they are automatically accepted | ||
}, | ||
}, | ||
// Default schedule | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think its alright if you remove the comment |
||
schedules: { | ||
create: { | ||
name: t("default_schedule_name"), | ||
availability: { | ||
createMany: { | ||
data: availability.map((schedule) => ({ | ||
days: schedule.days, | ||
startTime: schedule.startTime, | ||
endTime: schedule.endTime, | ||
})), | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}); | ||
|
||
|
@@ -908,6 +928,7 @@ export async function handleNewUsersInvites({ | |
orgConnectInfoByUsernameOrEmail, | ||
autoAcceptEmailDomain: autoAcceptEmailDomain, | ||
parentId: team.parentId, | ||
language, | ||
}); | ||
|
||
const sendVerifyEmailsPromises = invitationsForNewUsers.map((invitation) => { | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about we rename this to
defaultScheduleAvailability
ordefaultAvailability
?