Skip to content

Commit

Permalink
Mail notification improvement (DefectDojo#5610)
Browse files Browse the repository at this point in the history
- remove redundancy in IF
- consolidate structure (add html tags)
  • Loading branch information
kiblik authored Dec 30, 2021
1 parent e66cce7 commit a2768a3
Show file tree
Hide file tree
Showing 11 changed files with 156 additions and 90 deletions.
2 changes: 1 addition & 1 deletion dojo/templates/notifications/engagement_added.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<br/>
Kind regards,<br/>
<br/>
{% if system_settings.team_name and system_settings.team_name %}
{% if system_settings.team_name %}
{{ system_settings.team_name }}
{% else %}
Defect Dojo
Expand Down
62 changes: 40 additions & 22 deletions dojo/templates/notifications/other.tpl
Original file line number Diff line number Diff line change
@@ -1,26 +1,44 @@
{% if type == 'mail' %}
{% load navigation_tags %}
{% load display_tags %}
Hello,

{{ description|safe }}{% if url is not None %}
More information on this event can be found here: {{ url|full_url }}
{% endif %}

Kind regards,
{% if system_settings.team_name and system_settings.team_name %}
{{ system_settings.team_name }}
{% else %}
Defect Dojo
{% endif %}

{% if system_settings.disclaimer and system_settings.disclaimer.strip %}
<br/>
<div style="background-color:#DADCE2; border:1px #003333; padding:.8em; ">
<span style="font-size:16pt; font-family: 'Cambria','times new roman','garamond',serif; color:#ff0000;">Disclaimer</span><br/>
<p style="font-size:11pt; line-height:10pt; font-family: 'Cambria','times roman',serif;">{{ system_settings.disclaimer }}</p>
</div>
{% endif %}
{% load navigation_tags %}
{% load display_tags %}
<html>
<body>
{% autoescape on %}
<p>
Hello,
</p>
<p>
{{ description|safe }}
</p>
{% if url is not None %}
<br/>
<br/>
More information on this event can be found here: {{ url|full_url }}
{% endif %}
<br/>
<br/>
Kind regards, <br/>
{% if system_settings.team_name %}
{{ system_settings.team_name }}
{% else %}
Defect Dojo
{% endif %}
<br/>
<br/>
<p>
{% url 'notifications' as notification_url %}
You can manage your notification settings here: <a href="{{ notification_url|full_url }}">{{ notification_url|full_url }}</a>
</p>
{% if system_settings.disclaimer and system_settings.disclaimer.strip %}
<br/>
<div style="background-color:#DADCE2; border:1px #003333; padding:.8em; ">
<span style="font-size:16pt; font-family: 'Cambria','times new roman','garamond',serif; color:#ff0000;">Disclaimer</span><br/>
<p style="font-size:11pt; line-height:10pt; font-family: 'Cambria','times roman',serif;">{{ system_settings.disclaimer }}</p>
</div>
{% endif %}
{% endautoescape %}
</body>
</html>
{% elif type == 'alert' %}
{{ description|safe }}
{% elif type == 'slack' %}
Expand Down
2 changes: 1 addition & 1 deletion dojo/templates/notifications/product_added.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<br/>
Kind regards,<br/>
<br/>
{% if system_settings.team_name and system_settings.team_name %}
{% if system_settings.team_name %}
{{ system_settings.team_name }}
{% else %}
Defect Dojo
Expand Down
2 changes: 1 addition & 1 deletion dojo/templates/notifications/product_type_added.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<br/>
Kind regards,<br/>
<br/>
{% if system_settings.team_name and system_settings.team_name %}
{% if system_settings.team_name %}
{{ system_settings.team_name }}
{% else %}
Defect Dojo
Expand Down
53 changes: 33 additions & 20 deletions dojo/templates/notifications/report_created.tpl
Original file line number Diff line number Diff line change
@@ -1,24 +1,37 @@
{% if type == 'mail' %}
Greetings,

Your report "{{ report.name }}" is ready. It can be downloaded here: {{ url|full_url }}

Kind regards,
{% if system_settings.team_name and system_settings.team_name %}
{{ system_settings.team_name }}
{% else %}
Defect Dojo
{% endif %}
<br/>
<br/>

{% if system_settings.disclaimer and system_settings.disclaimer.strip %}
<br/>
<div style="background-color:#DADCE2; border:1px #003333; padding:.8em; ">
<span style="font-size:16pt; font-family: 'Cambria','times new roman','garamond',serif; color:#ff0000;">Disclaimer</span><br/>
<p style="font-size:11pt; line-height:10pt; font-family: 'Cambria','times roman',serif;">{{ system_settings.disclaimer }}</p>
</div>
{% endif %}
{% load navigation_tags %}
{% load display_tags %}
<html>
<body>
{% autoescape on %}
<p>
Greetings,
</p>
<p>
Your report "{{ report.name }}" is ready. It can be downloaded here: {{ url|full_url }}
</p>
Kind regards, <br/>
{% if system_settings.team_name %}
{{ system_settings.team_name }}
{% else %}
Defect Dojo
{% endif %}
<br/>
<br/>
<p>
{% url 'notifications' as notification_url %}
You can manage your notification settings here: <a href="{{ notification_url|full_url }}">{{ notification_url|full_url }}</a>
</p>
{% if system_settings.disclaimer and system_settings.disclaimer.strip %}
<br/>
<div style="background-color:#DADCE2; border:1px #003333; padding:.8em; ">
<span style="font-size:16pt; font-family: 'Cambria','times new roman','garamond',serif; color:#ff0000;">Disclaimer</span><br/>
<p style="font-size:11pt; line-height:10pt; font-family: 'Cambria','times roman',serif;">{{ system_settings.disclaimer }}</p>
</div>
{% endif %}
{% endautoescape %}
</body>
</html>
{% elif type == 'alert' %}
Your report "{{ report.name }}" is ready.
{% elif type == 'slack' %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<br/><br/>
Kind regards,
<br/><br/>
{% if system_settings.team_name and system_settings.team_name %}
{% if system_settings.team_name %}
{{ system_settings.team_name }}
{% else %}
Defect Dojo
Expand Down
2 changes: 1 addition & 1 deletion dojo/templates/notifications/scan_added.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<br/><br/>
Kind regards,
<br/><br/>
{% if system_settings.team_name and system_settings.team_name %}
{% if system_settings.team_name %}
{{ system_settings.team_name }}
{% else %}
Defect Dojo
Expand Down
2 changes: 1 addition & 1 deletion dojo/templates/notifications/sla_breach.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<br/></br>
Kind regards,
</br></br>
{% if system_settings.team_name and system_settings.team_name %}
{% if system_settings.team_name %}
{{ system_settings.team_name }}
{% else %}
Defect Dojo
Expand Down
2 changes: 1 addition & 1 deletion dojo/templates/notifications/test_added.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<br/>
Kind regards,</br>
<br/>
{% if system_settings.team_name and system_settings.team_name %}
{% if system_settings.team_name %}
{{ system_settings.team_name }}
{% else %}
Defect Dojo
Expand Down
57 changes: 37 additions & 20 deletions dojo/templates/notifications/upcoming_engagement.tpl
Original file line number Diff line number Diff line change
@@ -1,25 +1,42 @@
{% if type == 'mail' %}
Hello,

this is a reminder that the engagement "{{ engagement.product }}" is about to start shortly.

Project start: {{ engagement.target_start }}
Project end: {{ engagement.target_end }}

Kind regards,
{% if system_settings.team_name and system_settings.team_name %}
{{ system_settings.team_name }}
{% else %}
Defect Dojo
{% endif %}
<br/>
{% if system_settings.disclaimer and system_settings.disclaimer.strip %}
<br/>
<div style="background-color:#DADCE2; border:1px #003333; padding:.8em; ">
<span style="font-size:16pt; font-family: 'Cambria','times new roman','garamond',serif; color:#ff0000;">Disclaimer</span><br/>
<p style="font-size:11pt; line-height:10pt; font-family: 'Cambria','times roman',serif;">{{ system_settings.disclaimer }}</p>
</div>
{% endif %}
{% load navigation_tags %}
{% load display_tags %}
<html>
<body>
{% autoescape on %}
<p>
Hello,
</p>
<p>
this is a reminder that the engagement "{{ engagement.product }}" is about to start shortly.
</p>
Project start: {{ engagement.target_start }}<br/>
Project end: {{ engagement.target_end }}</br>
<br/>
<br/>
Kind regards, <br/>
{% if system_settings.team_name %}
{{ system_settings.team_name }}
{% else %}
Defect Dojo
{% endif %}
<br/>
<br/>
<p>
{% url 'notifications' as notification_url %}
You can manage your notification settings here: <a href="{{ notification_url|full_url }}">{{ notification_url|full_url }}</a>
</p>
{% if system_settings.disclaimer and system_settings.disclaimer.strip %}
<br/>
<div style="background-color:#DADCE2; border:1px #003333; padding:.8em; ">
<span style="font-size:16pt; font-family: 'Cambria','times new roman','garamond',serif; color:#ff0000;">Disclaimer</span><br/>
<p style="font-size:11pt; line-height:10pt; font-family: 'Cambria','times roman',serif;">{{ system_settings.disclaimer }}</p>
</div>
{% endif %}
{% endautoescape %}
</body>
</html>
{% elif type == 'alert' %}
The engagement "{{ engagement.product }}" is starting on {{ engagement.target_start }}.
{% elif type == 'slack' %}
Expand Down
60 changes: 39 additions & 21 deletions dojo/templates/notifications/user_mentioned.tpl
Original file line number Diff line number Diff line change
@@ -1,26 +1,44 @@
{% if type == 'mail' %}
Hello,
{% load navigation_tags %}
{% load display_tags %}
<html>
<body>
{% autoescape on %}
<p>
Hello,
</p>
<p>
User {{ user }} jotted a note on {{ section }}:<br/>
<br/>
{{ note }}<br/>
<br/>
It can be reviewed at {{ url }}
</p>

User {{ user }} jotted a note on {{ section }}:

{{ note }}

It can be reviewed at {{ url }}

Kind regards,
{% if system_settings.team_name and system_settings.team_name %}
{{ system_settings.team_name }}
{% else %}
Defect Dojo
{% endif %}
<br/>
{% if system_settings.disclaimer and system_settings.disclaimer.strip %}
<br/>
<div style="background-color:#DADCE2; border:1px #003333; padding:.8em; ">
<span style="font-size:16pt; font-family: 'Cambria','times new roman','garamond',serif; color:#ff0000;">Disclaimer</span><br/>
<p style="font-size:11pt; line-height:10pt; font-family: 'Cambria','times roman',serif;">{{ system_settings.disclaimer }}</p>
</div>
{% endif %}
<br/>
<br/>
Kind regards, <br/>
{% if system_settings.team_name %}
{{ system_settings.team_name }}
{% else %}
Defect Dojo
{% endif %}
<br/>
<br/>
<p>
{% url 'notifications' as notification_url %}
You can manage your notification settings here: <a href="{{ notification_url|full_url }}">{{ notification_url|full_url }}</a>
</p>
{% if system_settings.disclaimer and system_settings.disclaimer.strip %}
<br/>
<div style="background-color:#DADCE2; border:1px #003333; padding:.8em; ">
<span style="font-size:16pt; font-family: 'Cambria','times new roman','garamond',serif; color:#ff0000;">Disclaimer</span><br/>
<p style="font-size:11pt; line-height:10pt; font-family: 'Cambria','times roman',serif;">{{ system_settings.disclaimer }}</p>
</div>
{% endif %}
{% endautoescape %}
</body>
</html>
{% elif type == 'alert' %}
User {{ user }} jotted a note on {{ section }}:

Expand Down

0 comments on commit a2768a3

Please sign in to comment.