From afad78c5b361afde81fece543e4caec087f55207 Mon Sep 17 00:00:00 2001 From: Piotr Banaszkiewicz Date: Sat, 26 Oct 2024 18:41:52 +0200 Subject: [PATCH] [#2710] Allow editing cancelled emails --- amy/emails/models.py | 1 + amy/emails/tests/test_template_tags.py | 2 +- amy/emails/tests/test_views.py | 2 +- amy/templates/emails/scheduled_email_detail.html | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/amy/emails/models.py b/amy/emails/models.py index fe9c13d65..bb0916553 100644 --- a/amy/emails/models.py +++ b/amy/emails/models.py @@ -128,6 +128,7 @@ class ScheduledEmailStatus(models.TextChoices): "edit": [ ScheduledEmailStatus.SCHEDULED, ScheduledEmailStatus.FAILED, + ScheduledEmailStatus.CANCELLED, ], "reschedule": [ ScheduledEmailStatus.SCHEDULED, diff --git a/amy/emails/tests/test_template_tags.py b/amy/emails/tests/test_template_tags.py index 01589c831..a6e7d9777 100644 --- a/amy/emails/tests/test_template_tags.py +++ b/amy/emails/tests/test_template_tags.py @@ -33,4 +33,4 @@ def test_allowed_actions_for_status__specific_actions(self) -> None: result2 = allowed_actions_for_status(ScheduledEmailStatus.CANCELLED) # Assert self.assertEqual(result1, []) - self.assertEqual(result2, ["reschedule"]) + self.assertEqual(result2, ["edit", "reschedule"]) diff --git a/amy/emails/tests/test_views.py b/amy/emails/tests/test_views.py index 3de485cb5..7e345074f 100644 --- a/amy/emails/tests/test_views.py +++ b/amy/emails/tests/test_views.py @@ -517,7 +517,7 @@ def test_disallowed_email_statuses(self) -> None: for state in [ ScheduledEmailStatus.LOCKED, ScheduledEmailStatus.RUNNING, - ScheduledEmailStatus.CANCELLED, + ScheduledEmailStatus.SUCCEEDED, ] ] ) diff --git a/amy/templates/emails/scheduled_email_detail.html b/amy/templates/emails/scheduled_email_detail.html index c2dfd0d17..d30184ce4 100644 --- a/amy/templates/emails/scheduled_email_detail.html +++ b/amy/templates/emails/scheduled_email_detail.html @@ -20,7 +20,7 @@

{% if "edit" in available_status_actions %} Edit {% else %} - + Edit {% endif %}