-
Notifications
You must be signed in to change notification settings - Fork 12
role update email feature successfully implemented #126
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
Open
vijaykr338
wants to merge
6
commits into
dtutimes:main
Choose a base branch
from
vijaykr338:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
cce0e55
role update email feature successfully implemented
vijaykr338 1fedd2b
Merge branch 'main' into main
vijaykr338 190f3dd
Create .env.local
vijaykr338 9dc36c1
Discard changes to package-lock.json
dvishal485 4a9bd14
Discard changes to package.json
dvishal485 76adae5
fixed some CSS, now the email is sent to every superuser
vijaykr338 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| import { PopulatedUser } from "../../models/userModel"; | ||
| import Email, { APP_URL, COPYRIGHT_YEAR, DEVELOPER_FOOTER } from "../emailService"; | ||
| import MainWebsiteRole from "../../helpers/mainWebsiteRole"; | ||
|
|
||
| class RoleUpdateMail extends Email { | ||
| constructor(user: PopulatedUser, newRole: MainWebsiteRole, updatedBy: string) { | ||
| super(); | ||
| const { name } = user; | ||
|
|
||
| this.subject = "Your DTU Times Role Has Been Updated"; | ||
| this.html = ` | ||
| <html> | ||
| <head> | ||
| <meta charset="utf-8"> | ||
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
| <link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet"> | ||
| </head> | ||
| <body style="font-family: 'Montserrat', sans-serif; background-color: #f8f9fa; color: #333;"> | ||
| <div style="width: calc(80%); margin: 2rem auto; text-align: center; background-color: #fff; border-radius: 10px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); overflow: hidden;"> | ||
| <div style="padding: 1.5rem; background: #222222; color: white;"> | ||
| <div style="text-align: center;"> | ||
| <img src="http://dtutimes.dtu.ac.in/images/logo-dark.png" alt="DTU Times Logo" style="width: 12rem;"> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div style="padding: 2rem;"> | ||
| <h1 style="margin-top: 1rem; font-size: 2.2rem; font-weight: 300; text-align: center; color: #333;"> | ||
| Role Update | ||
| </h1> | ||
|
|
||
| <div style="margin: 1.5rem auto; font-size: 1rem; line-height: 1.6;"> | ||
| <p>Hey ${name},</p> | ||
| <p>Your role on DTU Times has been updated to:</p> | ||
| <div style="display: inline-block; padding: 0.6rem 1.2rem; background: #1ABC9C; color: white; border-radius: 8px; margin: 1rem 0; font-size: 1.1rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);"> | ||
| <strong>${MainWebsiteRole[newRole]}</strong> | ||
| </div> | ||
| <p>Updated by: ${updatedBy}</p> | ||
| </div> | ||
|
|
||
| <a href="${APP_URL}/member/profile" style="display: inline-block; padding: 0.8rem 1.5rem; background: #1ABC9C; color: white; border-radius: 5px; text-decoration: none; transition: background-color 0.3s ease;">View My Profile</a> | ||
| </div> | ||
|
|
||
| <footer style="background-color: #222222; color: #ddd; text-align: center; padding: 1rem; font-size: 0.7rem;"> | ||
| © DTU Times ${COPYRIGHT_YEAR}. All Rights Reserved. | ||
| <br /> | ||
| Developed by ${DEVELOPER_FOOTER} | ||
| </footer> | ||
| </div> | ||
| </body> | ||
| </html> | ||
| `; | ||
| } | ||
| } | ||
|
|
||
| export default RoleUpdateMail; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
can be good to add a comment here explaining why we send an email when team role is not defined.
also will the email be sent even if some permissions are updated ?
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.
now every superuser will receive the same email for change in permission
added a few comments
the email will be sent even if only PERMISSIONS are updated
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.
Went through the new commit.
Contrary to your though process, looking superuser with this way will actually fetch all user since no permission criteria is given.
You should rather use the
getUsersFromRoleIDwith role id of superuser (available as environment variable).