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

feat: select team members to receive emails #13957

Merged
merged 35 commits into from Mar 21, 2024

Conversation

asadath1395
Copy link
Contributor

@asadath1395 asadath1395 commented Mar 2, 2024

What does this PR do?

Fixes #13641

https://www.loom.com/share/0b953b7899224b28977f2a10f6f8e5a7?sid=56f772fd-00ad-4b12-ba5f-1251d0704998

Type of change

  • New feature (non-breaking change which adds functionality)

Mandatory Tasks

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

@graphite-app graphite-app bot added the community Created by Linear-GitHub Sync label Mar 2, 2024
@graphite-app graphite-app bot requested a review from a team March 2, 2024 10:45
Copy link

vercel bot commented Mar 2, 2024

@asadath1395 is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

@asadath1395 asadath1395 marked this pull request as draft March 2, 2024 10:45
Copy link
Contributor

github-actions bot commented Mar 2, 2024

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

@github-actions github-actions bot added consumer Medium priority Created by Linear-GitHub Sync routing-forms area: routing forms, routing, forms ui area: UI, frontend, button, form, input 🧹 Improvements Improvements to existing features. Mostly UX/UI labels Mar 2, 2024
Copy link

graphite-app bot commented Mar 2, 2024

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.

Copy link
Contributor

github-actions bot commented Mar 2, 2024

📦 Next.js Bundle Analysis for @calcom/web

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

One Page Changed Size

The following page changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load % of Budget (350 KB)
/apps/[slug]/[...pages] 560.47 KB 750.02 KB 214.29% (🟡 +0.56%)
Details

Only 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 next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

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.

@asadath1395 asadath1395 marked this pull request as ready for review March 4, 2024 08:40
@keithwillcode keithwillcode added this to the v3.9 milestone Mar 4, 2024
@CarinaWolli
Copy link
Member

@asadath1395 can you fix the type errors please 🙏

@asadath1395
Copy link
Contributor Author

@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.

@keithwillcode keithwillcode modified the milestones: v3.9, v4.0 Mar 5, 2024
@asadath1395
Copy link
Contributor Author

@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 yarn run type-check doesn't throw error but yarn run type-check:ci throws these weird type errors.

Copy link
Contributor

@joeauyeung joeauyeung left a 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?

packages/app-store/routing-forms/trpc/response.handler.ts Outdated Show resolved Hide resolved
@@ -36,6 +36,8 @@ export const listMembersHandler = async ({ ctx, input }: ListMembersOptions) =>
id: true,
name: true,
username: true,
email: true,
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment on lines 303 to 321
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]);
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment on lines 248 to 250
const { data: teamMembers } = form.teamId
? trpc.viewer.teams.listMembers.useQuery({ teamIds: [form.teamId] })
: { data: [] };
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@CarinaWolli
Copy link
Member

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?

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:
Screenshot 2024-03-18 at 3 08 58 PM

@asadath1395
Copy link
Contributor Author

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?

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: Screenshot 2024-03-18 at 3 08 58 PM

I have added a heading
image

@asadath1395
Copy link
Contributor Author

@joeauyeung Thanks for taking a look at this PR. I have addressed all your comments, mind reviewing the PR again. Thanks

Copy link
Member

@CarinaWolli CarinaWolli left a 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 🙏

@CarinaWolli CarinaWolli enabled auto-merge (squash) March 21, 2024 14:56
@CarinaWolli CarinaWolli merged commit 61a8543 into calcom:main Mar 21, 2024
30 of 38 checks passed
@dosubot dosubot bot modified the milestones: v4.0, v4.1 Apr 15, 2024
@keithwillcode keithwillcode modified the milestones: v4.1, v4.0 Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Created by Linear-GitHub Sync consumer 🧹 Improvements Improvements to existing features. Mostly UX/UI Medium priority Created by Linear-GitHub Sync routing-forms area: routing forms, routing, forms ui area: UI, frontend, button, form, input
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CAL-3119] routing forms: select team members to receive emails
5 participants