diff --git a/todo/templates/todo/email/assigned_body.txt b/todo/templates/todo/email/assigned_body.txt index 4287b92..deb71bc 100644 --- a/todo/templates/todo/email/assigned_body.txt +++ b/todo/templates/todo/email/assigned_body.txt @@ -1,6 +1,6 @@ {{ task.assigned_to.first_name }} - -A new task on the list {{ task.task_list.name }} has been assigned to you by {{ task.created_by.get_full_name }: +A new task on the list {{ task.task_list.name }} has been assigned to you by {{ task.created_by.get_full_name }}: {{ task.title }} diff --git a/todo/templates/todo/email/assigned_subject.txt b/todo/templates/todo/email/assigned_subject.txt index b6cc9db..4e1e2b8 100644 --- a/todo/templates/todo/email/assigned_subject.txt +++ b/todo/templates/todo/email/assigned_subject.txt @@ -1 +1 @@ -GTD: New task - {% autoescape off %}Note: {{ task.title }}{% endautoescape %} \ No newline at end of file +A new task has been assigned to you - {% autoescape off %}{{ task.title }}{% endautoescape %} \ No newline at end of file diff --git a/todo/utils.py b/todo/utils.py index 4a68b1f..1075481 100644 --- a/todo/utils.py +++ b/todo/utils.py @@ -21,11 +21,11 @@ def send_notify_mail(new_task): [new_task.assigned_to.email], fail_silently=False) -def send_email_to_thread_participants(task, msg_body, user): +def send_email_to_thread_participants(task, msg_body, user, subject=None): # Notify all previous commentors on a Task about a new comment. current_site = Site.objects.get_current() - email_subject = render_to_string("todo/email/assigned_subject.txt", {'task': task}) + email_subject = subject if subject else render_to_string("todo/email/assigned_subject.txt", {'task': task}) email_body = render_to_string( "todo/email/newcomment_body.txt", {'task': task, 'body': msg_body, 'site': current_site, 'user': user} diff --git a/todo/views.py b/todo/views.py index b2efbd8..98cec26 100644 --- a/todo/views.py +++ b/todo/views.py @@ -200,7 +200,9 @@ def task_detail(request, task_id: int) -> HttpResponse: body=request.POST['comment-body'], ) - send_email_to_thread_participants(task, request.POST['comment-body'], request.user) + send_email_to_thread_participants( + task, request.POST['comment-body'], request.user, + subject='New comment posted on task "{}"'.format(task.title)) messages.success(request, "Comment posted. Notification email sent to thread participants.") # Save task edits