diff --git a/hc/api/tests/test_bounce.py b/hc/api/tests/test_bounce.py index 7835abc7..e123f5ec 100644 --- a/hc/api/tests/test_bounce.py +++ b/hc/api/tests/test_bounce.py @@ -29,6 +29,7 @@ class BounceTestCase(BaseTestCase): self.channel.refresh_from_db() self.assertFalse(self.channel.email_verified) + self.assertEqual(self.channel.last_error, "foo") def test_it_checks_ttl(self): self.n.created = self.n.created - timedelta(minutes=60) diff --git a/hc/api/views.py b/hc/api/views.py index 4604aa79..ca5f5333 100644 --- a/hc/api/views.py +++ b/hc/api/views.py @@ -272,9 +272,13 @@ def bounce(request, code): notification.error = request.body.decode()[:200] notification.save() + notification.channel.last_error = notification.error if request.GET.get("type") in (None, "Permanent"): + # For permanent bounces, mark the channel as not verified, so we + # will not try to deliver to it again. notification.channel.email_verified = False - notification.channel.save() + + notification.channel.save() return HttpResponse()