Skip to content

Commit

Permalink
update: author name added in email template
Browse files Browse the repository at this point in the history
  • Loading branch information
nrjadkry committed Jul 23, 2024
1 parent 12c9b7c commit 403f862
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 3 additions & 4 deletions src/backend/app/email_templates/mapping_requests.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,19 +114,18 @@
<h1>Drone Tasking Manager Invite</h1>
</div>
<div class="content">
<p>Hello</p>
<p>Hello {{name}}</p>
<p>
Thank you for participating in our mapping project. Your contribution
is invaluable to our efforts in improving humanitarian responses
worldwide.
</p>
<p>Please find below the details of your mapping task:</p>
<p>{{requested_user_name}} has requested this task for mapping.</p>
<p>{{drone_operator_name}} has requested this task for mapping.</p>
<div class="task">
<h2>Mapping Task Details</h2>
<div class="task-details">
<p><strong>Task ID:</strong> #1234</p>
<p><strong>Project:</strong> Drone Tasking Manager</p>
<p><strong>Project:</strong>{{project_name}}</p>
<p>
<strong>Description:</strong> Drone Tasking Manager Project
Description
Expand Down
7 changes: 5 additions & 2 deletions src/backend/app/tasks/task_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
from app.tasks import task_schemas, task_crud
from app.users.user_deps import login_required
from app.users.user_schemas import AuthUser
from app.users.user_crud import get_user_by_id
from databases import Database
from app.db import database
from app.utils import send_email, render_email_template
from app.projects.project_crud import get_project_by_id


router = APIRouter(
prefix=f"{settings.API_PREFIX}/tasks",
tags=["tasks"],
Expand Down Expand Up @@ -47,13 +49,14 @@ async def new_event(
"Request for mapping",
)

# email notification
project = await get_project_by_id(db, project_id)
author = await get_user_by_id(db, project.author_id)

# email notification
html_content = render_email_template(
template_name="mapping_requests.html",
context={
"requested_user_name": user_data.name,
"name": author.name,
"drone_operator_name": user_data.name,
"task_id": task_id,
"project_name": project.name,
Expand Down

0 comments on commit 403f862

Please sign in to comment.