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
feat: select team members to receive emails #13957
feat: select team members to receive emails #13957
Conversation
@asadath1395 is attempting to deploy a commit to the cal Team on Vercel. A member of the Team first needs to authorize it. |
Thank you for following the naming conventions! 🙏 Feel free to join our discord and post your PR link. |
Graphite Automations"Add consumer team as reviewer" took an action on this PR • (03/02/24)1 reviewer was added to this PR based on Keith Williams's automation. "Add community label" took an action on this PR • (03/02/24)1 label was added to this PR based on Keith Williams's automation. |
📦 Next.js Bundle Analysis for @calcom/webThis analysis was generated by the Next.js Bundle Analysis action. 🤖 One Page Changed SizeThe following page changed size from the code in this PR compared to its base branch:
DetailsOnly the gzipped size is provided here based on an expert tip. First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If Any third party scripts you have added directly to your app using the The "Budget %" column shows what percentage of your performance budget the First Load total takes up. For example, if your budget was 100kb, and a given page's first load size was 10kb, it would be 10% of your budget. You can also see how much this has increased or decreased compared to the base branch of your PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this. If you see "+/- <0.01%" it means that there was a change in bundle size, but it is a trivial enough amount that it can be ignored. |
… routing form updates to
…d of only the current team where the routing form is created
@asadath1395 can you fix the type errors please 🙏 |
@CarinaWolli The type errors are not from my changes, since i touched that file, its showing already existing ones i think. Strange😬. Anyways onto fixing them. |
…asadath1395/cal.com into add-team-members-receive-emails
@CarinaWolli I am seeing strange behaviour, the moment i fix something in the imports, the other file starts throwing more type errors, any idea on why that is happening? Also |
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.
Thanks for your contribution @asadath1395. I left some non-blocking comments. One question I have is if no member is assigned should we default sending the form to the organizer or just leave it as is @CarinaWolli?
@@ -36,6 +36,8 @@ export const listMembersHandler = async ({ ctx, input }: ListMembersOptions) => | |||
id: true, | |||
name: true, | |||
username: true, | |||
email: true, |
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.
When submitting the routing form we query the DB again for the user email. Let's not include the user email in the list member's query then.
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.
Done
useEffect(() => { | ||
if (form.teamId && form.settings?.sendUpdatesTo?.length && teamMembers?.length) { | ||
let sendToAll = true; | ||
teamMembers.forEach((member) => { | ||
if (!form.settings?.sendUpdatesTo?.includes(member.id)) { | ||
sendToAll = false; | ||
return; | ||
} | ||
}); | ||
setAssignAllTeamMembers(sendToAll); | ||
setSelectedMembers( | ||
form.settings.sendUpdatesTo.map((userId) => ({ | ||
isFixed: true, | ||
userId: userId, | ||
priority: 1, | ||
})) | ||
); | ||
} | ||
}, [form.teamId, form.settings?.sendUpdatesTo?.length, teamMembers?.length]); |
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.
Could we instead add to the form a sendToAll
and a sendUpdatesTo
field?
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.
Done
const { data: teamMembers } = form.teamId | ||
? trpc.viewer.teams.listMembers.useQuery({ teamIds: [form.teamId] }) | ||
: { data: [] }; |
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.
If we are querying the team members everytime the form has a teamId
can we move this to server side and include it in the formQuery.handler
?
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.
Done
I think it's fine to not send an email if no member is selected But we need to add a heading to this, right now we don't mention anywhere that this is for email sending: |
…m-members-receive-emails
…asadath1395/cal.com into add-team-members-receive-emails
…asadath1395/cal.com into add-team-members-receive-emails
|
@joeauyeung Thanks for taking a look at this PR. I have addressed all your comments, mind reviewing the PR again. Thanks |
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.
Great work, looks good 🙌🏻 Thank you for your contribution 🙏
What does this PR do?
Fixes #13641
https://www.loom.com/share/0b953b7899224b28977f2a10f6f8e5a7?sid=56f772fd-00ad-4b12-ba5f-1251d0704998
Type of change
Mandatory Tasks