mirror of
https://github.com/jlengrand/bugsink.git
synced 2026-03-10 08:01:17 +00:00
Reordering of the order of elements in subject/first-line
most important change: 'New issue' from start of the subject to its end. This was prompted by getting flooded with 'New issue' emails, but you want to know _what_ first.
This commit is contained in:
@@ -15,26 +15,26 @@ def _get_users_for_email_alert(issue):
|
||||
|
||||
@shared_task
|
||||
def send_new_issue_alert(issue_id):
|
||||
_send_alert(issue_id, "New issue:", "a", "NEW")
|
||||
_send_alert(issue_id, "New issue", "a", "NEW")
|
||||
|
||||
|
||||
@shared_task
|
||||
def send_regression_alert(issue_id):
|
||||
_send_alert(issue_id, "Regression:", "a", "REGRESSED")
|
||||
_send_alert(issue_id, "Regression", "a", "REGRESSED")
|
||||
|
||||
|
||||
@shared_task
|
||||
def send_unmute_alert(issue_id):
|
||||
_send_alert(issue_id, "Unmuted issue:", "an", "UNMUTED")
|
||||
_send_alert(issue_id, "Unmuted issue", "an", "UNMUTED")
|
||||
|
||||
|
||||
def _send_alert(issue_id, subject_prefix, alert_article, alert_reason):
|
||||
def _send_alert(issue_id, state_description, alert_article, alert_reason):
|
||||
from issues.models import Issue # avoid circular import
|
||||
|
||||
issue = Issue.objects.get(id=issue_id)
|
||||
for membership in _get_users_for_email_alert(issue):
|
||||
send_rendered_email(
|
||||
subject=truncatechars(f'{subject_prefix} "{issue.title()}" in "{issue.project.name}"', 100),
|
||||
subject=truncatechars(f'"{issue.title()}" in "{issue.project.name}" ({state_description})', 100),
|
||||
base_template_name="alerts/issue_alert",
|
||||
recipient_list=[membership.user.email],
|
||||
context={
|
||||
@@ -43,6 +43,7 @@ def _send_alert(issue_id, subject_prefix, alert_article, alert_reason):
|
||||
"issue_title": issue.title(),
|
||||
"project_name": issue.project.name,
|
||||
"issue_url": settings.BASE_URL + issue.get_absolute_url(),
|
||||
"state_description": state_description,
|
||||
"alert_article": alert_article,
|
||||
"alert_reason": alert_reason,
|
||||
"settings_url": settings.BASE_URL + "/", # TODO
|
||||
|
||||
@@ -454,7 +454,7 @@
|
||||
</style>
|
||||
</head>
|
||||
<body style="width: 100% !important; height: 100%; -webkit-text-size-adjust: none; font-family: "Nunito Sans", Helvetica, Arial, sans-serif; background-color: #F2F4F6; color: #51545E; margin: 0;" bgcolor="#F2F4F6">
|
||||
<span class="preheader" style="display: none !important; visibility: hidden; mso-hide: all; font-size: 1px; line-height: 1px; max-height: 0; max-width: 0; opacity: 0; overflow: hidden;">{# As I understand it, this hidden div is specifically meant to be shown in email clients' preview (preview of message content in list of emails); we intentionally reverse the order of pieces of information here (w.r.t. sender and subject) to maximize the chance that this line contains info that doesn't fit on other lines #}Project "{{ project_name }}" - {{ issue_title }}</span>
|
||||
<span class="preheader" style="display: none !important; visibility: hidden; mso-hide: all; font-size: 1px; line-height: 1px; max-height: 0; max-width: 0; opacity: 0; overflow: hidden;">{# As I understand it, this hidden div is specifically meant to be shown in email clients' preview (preview of message content in list of emails); we intentionally reverse the order of pieces of information here (w.r.t. sender and subject) to maximize the chance that this line contains info that doesn't fit on other lines #}{{ state_description }} on "{{ project_name }}" - {{ issue_title }}</span>
|
||||
<table class="email-wrapper" width="100%" cellpadding="0" cellspacing="0" role="presentation" style="width: 100%; -premailer-width: 100%; -premailer-cellpadding: 0; -premailer-cellspacing: 0; background-color: #F2F4F6; margin: 0; padding: 0;" bgcolor="#F2F4F6">
|
||||
<tr>
|
||||
<td align="center" style="word-break: break-word; font-family: "Nunito Sans", Helvetica, Arial, sans-serif; font-size: 16px;">
|
||||
|
||||
Reference in New Issue
Block a user