Skip to content

fix: issues with verified emails in workflow#15965

Merged
CarinaWolli merged 6 commits intomainfrom
fix/verified-email
Jul 31, 2024
Merged

fix: issues with verified emails in workflow#15965
CarinaWolli merged 6 commits intomainfrom
fix/verified-email

Conversation

@CarinaWolli
Copy link
Copy Markdown
Member

What does this PR do?

getVerifiedEmails returned all team members emails as verified, but verifyEmailSender didn't which caused issues.

Now both look for: the user's email, team members emails, verified emails

How should this be tested?

  • Create team workflow
  • Choose send email to specific email
  • Type in the logged in user's email, this should be automatically verified
  • Click save, workflow should be saved with the verified user's email
  • A new entry for verifiedEmail should be created, so email will show as verified also when other team members view the workflow

const { user } = ctx;
const { teamId } = input;
let verifiedEmails: VerifiedEmail[] = [];
let verifiedEmails: string[] = [user.email];
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

user email should show as automatically verified

we only need the emails, so no need to return the whole VerifiedEmail object

Copy link
Copy Markdown
Member

@hariombalhara hariombalhara Jul 31, 2024

Choose a reason for hiding this comment

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

Could it be that the logged in user hasn't verified his email and setting up the workflow?

Would it be okay to consider the email as verified in that case?

return;
}

const userEmail = await prisma.user.findFirst({
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

if we didn't find verifiedEmail in the db, check if it's the user's email and later if it's one of the team members email

}
}

throw new TRPCError({ code: "NOT_FOUND", message: "Email not verified" });
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

No entry for verifiedEmail found and it's also not the user's email or any of the team members email

@CarinaWolli CarinaWolli requested a review from a team July 29, 2024 08:40
@CarinaWolli CarinaWolli marked this pull request as ready for review July 29, 2024 08:40
@CarinaWolli CarinaWolli added the 🐛 bug Something isn't working label Jul 29, 2024
@CarinaWolli CarinaWolli added this to the v4.4 milestone Jul 29, 2024
@dosubot dosubot bot added emails area: emails, cancellation email, reschedule email, inbox, spam folder, not getting email workflows area: workflows, automations labels Jul 29, 2024
@CarinaWolli CarinaWolli removed the emails area: emails, cancellation email, reschedule email, inbox, spam folder, not getting email label Jul 29, 2024
@vercel
Copy link
Copy Markdown

vercel bot commented Jul 29, 2024

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

3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
ai ⬜️ Ignored (Inspect) Visit Preview Jul 31, 2024 11:40am
cal ⬜️ Ignored (Inspect) Visit Preview Jul 31, 2024 11:40am
calcom-web-canary ⬜️ Ignored (Inspect) Visit Preview Jul 31, 2024 11:40am

Comment thread packages/trpc/server/routers/viewer/workflows/util.ts Outdated
Comment thread packages/trpc/server/routers/viewer/workflows/util.ts
@CarinaWolli CarinaWolli enabled auto-merge (squash) July 31, 2024 07:38
Comment on lines +136 to +141
members: {
include: {
user: {
select: {
id: true,
email: true,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we filter out pending members?

Comment on lines 162 to 168
await prisma.verifiedEmail.create({
data: {
email,
userId,
teamId,
},
});
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's create a repository for VerifiedEmail in a followup.

Copy link
Copy Markdown
Member

@hariombalhara hariombalhara left a comment

Choose a reason for hiding this comment

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

Verified that update was failing earlier and is fixed in this branch.

LGTM !! I think we can follow up with some unit tests for verifyEmail

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛 bug Something isn't working consumer core area: core, team members only High priority Created by Linear-GitHub Sync ready-for-e2e workflows area: workflows, automations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants