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: Add email template for inviting user to workspace #480

Conversation

Allan2000-Git
Copy link
Contributor

@Allan2000-Git Allan2000-Git commented Oct 6, 2024

User description

Description

This PR adds an email template for inviting user to project. It provides users with key information regarding the project name
project joining URL, invited by, invited on and invitation role.

Fixes #54

Dependencies

No new dependencies introduced.

Future Improvements

N/A

Mentions

@rajdip-b

Screenshots of relevant screens

workspace-invitation-email

Developer's checklist

  • My PR follows the style guidelines of this project
  • I have performed a self-check on my work

If changes are made in the code:

  • I have followed the coding guidelines
  • My changes in code generate no new warnings
  • My changes are breaking another fix/feature of the project
  • I have added test cases to show that my feature works
  • I have added relevant screenshots in my PR
  • There are no UI/UX issues

Documentation Update

  • This PR requires an update to the documentation at docs.keyshade.xyz
  • I have made the necessary updates to the documentation, or no documentation changes are required.

PR Type

enhancement


Description

  • Added a new userInvitation method to the IMailService interface, allowing for user invitations via email.
  • Implemented the userInvitation method in MailService, which sends an HTML formatted email containing project invitation details and a call-to-action button.
  • Created a mock version of the userInvitation method in MockMailService for testing, which logs the invitation details.

Changes walkthrough 📝

Relevant files
Enhancement
interface.service.ts
Add user invitation method to mail service interface         

apps/api/src/mail/services/interface.service.ts

  • Added userInvitation method to the IMailService interface.
  • Method includes parameters for email, project details, inviter, and
    role.
  • +9/-0     
    mail.service.ts
    Implement user invitation email with HTML template             

    apps/api/src/mail/services/mail.service.ts

  • Implemented userInvitation method in MailService.
  • Constructed HTML email template for project invitation.
  • Included project details and call-to-action button in the email.
  • +184/-0 
    Tests
    mock.service.ts
    Add mock user invitation method for testing                           

    apps/api/src/mail/services/mock.service.ts

  • Added mock implementation of userInvitation method.
  • Logs invitation details for testing purposes.
  • +13/-0   

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Code Duplication
    The HTML email template in the userInvitation method contains a lot of inline CSS. Consider extracting this into a separate CSS file or using a CSS-in-JS solution to improve maintainability.

    Hardcoded URLs
    The email template contains hardcoded URLs for privacy policy and terms and conditions. Consider making these configurable or storing them in environment variables.

    Copy link
    Contributor

    PR Code Suggestions ✨

    No code suggestions found for the PR.

    @rajdip-b
    Copy link
    Member

    rajdip-b commented Oct 7, 2024

    Hey man, that's some impressive work. Although again, the scope of this issue is outdated. So it would be Workspace, not project. And gladly, we already have a function for workspace. All you would need is to update the stylings of that mail template.

    Additionally, I would like to take a call from @kriptonian1 @darksaiii about the design decisions.

    @kriptonian1
    Copy link
    Contributor

    @Allan2000-Git I like the work, but can you do the implementation in React email, they have better support for all email client and also have accessibility for clients which doesn't support HTML.

    @Allan2000-Git
    Copy link
    Contributor Author

    @rajdip-b Will rename project to workspace.
    @kriptonian1 I guess all the templates are written in plain HTML & CSS in mail.service.ts. Should I change everyone of them or just keep the scope for the current PR?

    @kriptonian1
    Copy link
    Contributor

    @rajdip-b Will rename project to workspace. @kriptonian1 I guess all the templates are written in plain HTML & CSS in mail.service.ts. Should I change everyone of them or just keep the scope for the current PR?

    @rajdip-b should we make a new issue for this

    @rajdip-b
    Copy link
    Member

    rajdip-b commented Oct 8, 2024

    A new PR would be really great. I don't think we need a new issue for that, adding hacktoberfest-accepted to the PR should be enough.

    @kriptonian1
    Copy link
    Contributor

    A new PR would be really great. I don't think we need a new issue for that, adding hacktoberfest-accepted to the PR should be enough.

    Yes, as per as I know, they just count the PR with hacktoberfest-accepted tag

    @rajdip-b rajdip-b force-pushed the feat/user-invitation-email-template branch from 90b8aed to 92ff06e Compare October 13, 2024 11:15
    @rajdip-b rajdip-b changed the title feat: Add email template for inviting user to project feat: Add email template for inviting user to workspace Oct 13, 2024
    @rajdip-b
    Copy link
    Member

    Hey man, that's some impressive work. Although again, the scope of this issue is outdated. So it would be Workspace, not project. And gladly, we already have a function for workspace. All you would need is to update the stylings of that mail template.

    Additionally, I would like to take a call from @kriptonian1 @darksaiii about the design decisions.

    @Allan2000-Git if you can implement these changes, I will be happy to merge.

    @Allan2000-Git
    Copy link
    Contributor Author

    Hey man, that's some impressive work. Although again, the scope of this issue is outdated. So it would be Workspace, not project. And gladly, we already have a function for workspace. All you would need is to update the stylings of that mail template.
    Additionally, I would like to take a call from @kriptonian1 @darksaiii about the design decisions.

    @Allan2000-Git if you can implement these changes, I will be happy to merge.

    @rajdip-b Since the template has to be designed using react-email, it's bit difficult since I'm not able to preview the code. So would need help there.

    @rajdip-b
    Copy link
    Member

    @kriptonian1 can you please help him out?

    @rajdip-b rajdip-b added the hacktoberfest-accepted Your PR has this = Congrats! label Oct 13, 2024
    @kriptonian1
    Copy link
    Contributor

    Hey man, that's some impressive work. Although again, the scope of this issue is outdated. So it would be Workspace, not project. And gladly, we already have a function for workspace. All you would need is to update the stylings of that mail template.
    Additionally, I would like to take a call from @kriptonian1 @darksaiii about the design decisions.

    @Allan2000-Git if you can implement these changes, I will be happy to merge.

    @rajdip-b Since the template has to be designed using react-email, it's bit difficult since I'm not able to preview the code. So would need help there.

    React email has preview, I'll recommend you to go through the docs and watch some tutorials on YouTube before diving into it.

    Here is a video you can refer to

    https://youtu.be/pHXHBHdTzrM?si=BAg-r_EYyJmfhK2W

    @rajdip-b
    Copy link
    Member

    rajdip-b commented Nov 2, 2024

    @Allan2000-Git hey buddy, any updates on this?

    @Allan2000-Git
    Copy link
    Contributor Author

    Allan2000-Git commented Nov 2, 2024

    @rajdip-b There's already a PR with react email usage. Since most the things are failing, so I didn't go ahead with the same here.

    @Allan2000-Git
    Copy link
    Contributor Author

    Template is ready and is working fine

    @Allan2000-Git
    Copy link
    Contributor Author

    Can you pull the changes from this PR and check. Would be of great help

    apps/api/src/mail/services/interface.service.ts Outdated Show resolved Hide resolved
    apps/api/src/mail/emails/workspace-invitation.tsx Outdated Show resolved Hide resolved
    @rajdip-b rajdip-b merged commit f5ddf7a into keyshade-xyz:develop Dec 7, 2024
    4 checks passed
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    Mail template for inviting user to project
    3 participants