fix: include docname in email header
This commit is contained in:
parent
42a7ee190a
commit
92391c10e6
1 changed files with 9 additions and 15 deletions
|
|
@ -83,14 +83,13 @@ def send_notification_email(doc):
|
|||
doc_link = get_url_to_form(doc.document_type, doc.document_name)
|
||||
header = get_email_header(doc)
|
||||
email_subject = strip_html(doc.subject)
|
||||
body_content = get_email_body_content(doc)
|
||||
|
||||
frappe.sendmail(
|
||||
recipients = doc.for_user,
|
||||
subject = email_subject,
|
||||
template = "new_notification",
|
||||
args = {
|
||||
'body_content': body_content,
|
||||
'body_content': doc.subject,
|
||||
'description': doc.email_content,
|
||||
'document_type': doc.document_type,
|
||||
'document_name': doc.document_name,
|
||||
|
|
@ -100,22 +99,17 @@ def send_notification_email(doc):
|
|||
now=frappe.flags.in_test
|
||||
)
|
||||
|
||||
def get_email_body_content(doc):
|
||||
#include document name in email content
|
||||
title_html = get_title_html(get_title(doc.document_type, doc.document_name))
|
||||
subject_parts = doc.subject.partition(title_html)
|
||||
body_content = "{0}{1} ({2}){3}".format(subject_parts[0], subject_parts[1], doc.document_name, subject_parts[2])
|
||||
return body_content
|
||||
|
||||
def get_email_header(doc):
|
||||
return {
|
||||
docname = doc.document_name
|
||||
header_map = {
|
||||
'Default': _('New Notification'),
|
||||
'Mention': _('New Mention'),
|
||||
'Assignment': _('Assignment Update'),
|
||||
'Share': _('New Document Shared'),
|
||||
'Energy Point': _('Energy Point Update'),
|
||||
}[doc.type or 'Default']
|
||||
'Mention': _('New Mention on {0}').format(docname),
|
||||
'Assignment': _('Assignment Update on {0}').format(docname),
|
||||
'Share': _('New Document Shared {0}').format(docname),
|
||||
'Energy Point': _('Energy Point Update on {0}').format(docname),
|
||||
}
|
||||
|
||||
return header_map[doc.type or 'Default']
|
||||
|
||||
@frappe.whitelist()
|
||||
def mark_all_as_read():
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue