hc.api.views.bounce updates Channel.last_error

This commit is contained in:
Pēteris Caune 2020-01-08 11:14:34 +02:00
parent c521b44d20
commit b8108906f4
No known key found for this signature in database
GPG Key ID: E28D7679E9A9EDE2
2 changed files with 6 additions and 1 deletions

View File

@ -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)

View File

@ -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()