0
0
Fork 0
mirror of https://github.com/healthchecks/healthchecks.git synced 2025-04-08 06:30:05 +00:00

Update email template to handle not yet uploaded ping bodies

This commit is contained in:
Pēteris Caune 2022-04-13 10:43:12 +03:00
parent bb38ad3187
commit 32f021b9c5
No known key found for this signature in database
GPG key ID: E28D7679E9A9EDE2
3 changed files with 25 additions and 0 deletions

View file

@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file.
### Bug Fixes
- Fix unwanted localization in badge SVG generation (#629)
- Update email template to handle not yet uploaded ping bodies
## v2.0.1 - 2022-03-18

View file

@ -189,3 +189,18 @@ class NotifyEmailTestCase(BaseTestCase):
email = mail.outbox[0]
self.assertEqual(email.subject, "DOWN | Foo & Bar")
@override_settings(S3_BUCKET="test-bucket")
@patch("hc.api.models.get_object")
def test_it_handles_pending_body(self, get_object):
get_object.return_value = None
self.ping.object_size = 1000
self.ping.body_raw = None
self.ping.save()
self.channel.notify(self.check)
email = mail.outbox[0]
html = email.alternatives[0][0]
self.assertIn("The request body data is being processed", html)

View file

@ -98,8 +98,17 @@
{% if ping and ping.has_body %}
<p><b>Last Ping Body</b></p>
{% with ping.get_body as body %}
{% if body is None %}
<p>
The request body data is being processed will be available for viewing shortly.
Please <a href="{{ check.cloaked_url }}">view it on the website</a>.
</p>
{% else %}
<pre style="font-family: monospace; line-height: 1em;">{{ ping.get_body|slice:":10000"|linebreaksbr }}{% if ping.get_body|length > 10000 %} [truncated]{% endif %}</pre>
{% endif %}
{% endwith %}
{% endif %}
{% if projects %}
<p><b>Projects Overview</b></p>