diff --git a/hc/api/tests/test_notification_status.py b/hc/api/tests/test_notification_status.py index 25128681..9006fd54 100644 --- a/hc/api/tests/test_notification_status.py +++ b/hc/api/tests/test_notification_status.py @@ -57,7 +57,11 @@ class NotificationStatusTestCase(BaseTestCase): self.n.save() r = self.client.post(self.url, {"MessageStatus": "failed"}) - self.assertEqual(r.status_code, 403) + self.assertEqual(r.status_code, 200) + + # The notification should not have the error field set: + self.n.refresh_from_db() + self.assertEqual(self.n.error, "") def test_it_handles_missing_notification(self): fake_code = "07c2f548-9850-4b27-af5d-6c9dc157ec02" diff --git a/hc/api/views.py b/hc/api/views.py index a909f611..9003d717 100644 --- a/hc/api/views.py +++ b/hc/api/views.py @@ -422,10 +422,11 @@ def notification_status(request, code): notification = get_object_or_404(Notification, code=code) - # If webhook is more than 1 hour late, don't accept it: td = timezone.now() - notification.created if td.total_seconds() > 3600: - return HttpResponseForbidden() + # If the webhook is called more than 1 hour after the notification, ignore it. + # Return HTTP 200 so the other party doesn't retry over and over again: + return HttpResponse() error, mark_not_verified = None, False