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: Workflow — Send Email to Specific Email #14815

Merged
merged 22 commits into from
May 20, 2024

Conversation

Amit91848
Copy link
Contributor

@Amit91848 Amit91848 commented Apr 30, 2024

What does this PR do?

Fixes #14466

I don't have sendgrid account cannot show the email, instead showing the logs.

Screen.Recording.2024-04-30.at.10.17.05.PM.mov

Pending

  • Table for Verified Emails like there is of VerifiedNumber

Type of change

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

Mandatory Tasks

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

Copy link

vercel bot commented Apr 30, 2024

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

A member of the Team first needs to authorize it.

@github-actions github-actions bot added emails area: emails, cancellation email, reschedule email, inbox, spam folder, not getting email Medium priority Created by Linear-GitHub Sync workflows area: workflows, automations ✨ feature New feature or request labels Apr 30, 2024
Copy link
Contributor

github-actions bot commented Apr 30, 2024

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

@graphite-app graphite-app bot added the community Created by Linear-GitHub Sync label Apr 30, 2024
@graphite-app graphite-app bot requested a review from a team April 30, 2024 16:58
Copy link

graphite-app bot commented Apr 30, 2024

Graphite Automations

"Add community label" took an action on this PR • (04/30/24)

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

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

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

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

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

Copy link
Contributor

github-actions bot commented Apr 30, 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)
/workflows/[workflow] 412.17 KB 640.72 KB 183.06% (🟡 +0.15%)
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.

@CarinaWolli CarinaWolli added this to the v4.1 milestone Apr 30, 2024
@github-actions github-actions bot added the ❗️ migrations contains migration files label May 1, 2024
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 so far, I left you some comments that need to be addressed first 🙏

And I think the implemenation for EMAIL_ADRESSE is missing in activateEventType.handler.ts


export const getVerifiedEmailsHandler = async ({ ctx, input }: GetVerifiedEmailsOptions) => {
const { user } = ctx;
const verifiedEmails = await prisma.verifiedEmail.findMany({
Copy link
Member

Choose a reason for hiding this comment

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

If it's a team workflow, I think it would be nice to show all emails of team members automatically as verified.

/*case WorkflowActions.EMAIL_ADDRESS:
sendTo = step.sendTo || "";*/
case WorkflowActions.EMAIL_ADDRESS:
sendTo = step.sendTo ? [step.sendTo] : [];
Copy link
Member

Choose a reason for hiding this comment

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

Let's add a check to make sure that the sendTo email is actually verified. Also if it is a team workflow and we find that the email is verified for the user only let's add the team to the verifiedEmail as well.

That would solve the following issue:
Member1 has a user workflow and verifies an email to use in this workflow. Member1 creates a team workflow and uses the same email again which automatically shows as verified. Member2 tries to edit the team workflow but the email doesn't show as verified for them and they can't make any changes before they verify the email themselves

@Amit91848
Copy link
Contributor Author

Made changes @CarinaWolli

@Amit91848 Amit91848 requested a review from CarinaWolli May 5, 2024 17:46
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.

  • Right now not verified emails can be saved to the workflow, we should add an error message like for SMS to specific number:
Screenshot 2024-05-09 at 12 50 38 PM
  • Can we change the title of the email form 'Cal.com: Verify your account' to 'Cal.com: Verify your email'

@dosubot dosubot bot modified the milestones: v4.1, v4.2 May 9, 2024
@Amit91848
Copy link
Contributor Author

Also cannot open workflow page, keep getting this error.

Screenshot 2024-05-13 at 2 48 43 PM
Screenshot 2024-05-13 at 2 48 58 PM

@CarinaWolli
Copy link
Member

Also cannot open workflow page, keep getting this error.

For the getStaticProps() error, can you try to set the env variable APP_ROUTER_WORKFLOWS_ENABLED to 0

@Amit91848
Copy link
Contributor Author

Also cannot open workflow page, keep getting this error.

For the getStaticProps() error, can you try to set the env variable APP_ROUTER_WORKFLOWS_ENABLED to 0

Was already 0, tried with 1 also, still getting the same error

@CarinaWolli
Copy link
Member

Also cannot open workflow page, keep getting this error.

For the getStaticProps() error, can you try to set the env variable APP_ROUTER_WORKFLOWS_ENABLED to 0

Was already 0, tried with 1 also, still getting the same error

did you restart the yarn dev server after changing the env. variable? For me it works, I am getting the same error if I set the env variable to 1

@Amit91848
Copy link
Contributor Author

did you restart the yarn dev server after changing the env. variable? For me it works, I am getting the same error if I set the env variable to 1

Yup still getting the same error

Screen.Recording.2024-05-13.at.10.40.42.PM.mov

Works if i comment this tho

middleware: abTestMiddlewareFactory(middleware),

@graphite-app graphite-app bot requested a review from a team May 13, 2024 18:00
@Amit91848
Copy link
Contributor Author

Made changes @CarinaWolli

@dosubot dosubot bot added this to the v4.2 milestone May 15, 2024
/*case WorkflowActions.EMAIL_ADDRESS:
sendTo = step.sendTo || "";*/
case WorkflowActions.EMAIL_ADDRESS:
await verifyEmailSender(newStep.sendTo || "", user.id, userWorkflow.teamId, ctx.prisma);
Copy link
Member

Choose a reason for hiding this comment

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

for added steps we only call it when we have bookings that need reminders scheduled. We should do it the same as we do for the edited steps

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah removed it from here and added when creating new step

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, all issues are resolved and it is working as expected 🙏

@CarinaWolli CarinaWolli enabled auto-merge (squash) May 20, 2024 16:15
@CarinaWolli CarinaWolli merged commit bd6c471 into calcom:main May 20, 2024
32 of 40 checks passed
p6l-richard pushed a commit to p6l-richard/cal.com-fork that referenced this pull request Jul 22, 2024
* feat: Workflow — Send Email to Specific Email

* disable button when verifyEmail pending

* add verified emails table and routes

* fix: include teamId in verifyEmailCode

* fix: include email address in activate handler

* fix: check team before adding email

* feat: check verified email, add to team if only users

* remove logs

* fix: if statement

Co-authored-by: Carina Wollendorfer <30310907+CarinaWolli@users.noreply.github.com>

* change email to verify your email

* fix: show error if saving unverified email

* fix: show email in subject

* verify email when editing steps

* remove double calls from same block

* verify email when creating new step

---------

Co-authored-by: v0ltZzie <161201747+v0ltZzie@users.noreply.github.com>
Co-authored-by: Carina Wollendorfer <30310907+CarinaWolli@users.noreply.github.com>
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 emails area: emails, cancellation email, reschedule email, inbox, spam folder, not getting email ✨ feature New feature or request Medium priority Created by Linear-GitHub Sync ❗️ migrations contains migration files workflows area: workflows, automations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CAL-3372] Workflow — Send Email to Specific Email
3 participants