Skip to content

Commit

Permalink
[#2459] Disallow editing successfully sent emails
Browse files Browse the repository at this point in the history
  • Loading branch information
pbanaszkiewicz committed Sep 18, 2023
1 parent 2448a4d commit 4227441
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 5 deletions.
2 changes: 0 additions & 2 deletions amy/emails/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,6 @@ class ScheduledEmailStatus(models.TextChoices):
"edit": [
ScheduledEmailStatus.SCHEDULED,
ScheduledEmailStatus.FAILED,
# note: will not re-send the email or affect emails already sent
ScheduledEmailStatus.SUCCEEDED,
],
"reschedule": [
ScheduledEmailStatus.SCHEDULED,
Expand Down
2 changes: 1 addition & 1 deletion amy/emails/tests/test_template_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,5 @@ def test_allowed_actions_for_status__specific_actions(self) -> None:
result1 = allowed_actions_for_status(ScheduledEmailStatus.SUCCEEDED)
result2 = allowed_actions_for_status(ScheduledEmailStatus.CANCELLED)
# Assert
self.assertEqual(result1, ["edit"])
self.assertEqual(result1, [])
self.assertEqual(result2, ["reschedule"])
3 changes: 1 addition & 2 deletions amy/emails/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,6 @@ def test_allowed_email_statuses(self) -> None:
for state in [
ScheduledEmailStatus.SCHEDULED,
ScheduledEmailStatus.FAILED,
ScheduledEmailStatus.SUCCEEDED,
]
]
)
Expand All @@ -467,7 +466,7 @@ def test_allowed_email_statuses(self) -> None:
results = queryset.all()

# Assert - all of the defined scheduled emails can be retrieved with this query
self.assertEqual(results.count(), 3)
self.assertEqual(results.count(), 2)

@override_settings(EMAIL_MODULE_ENABLED=True)
def test_disallowed_email_statuses(self) -> None:
Expand Down

0 comments on commit 4227441

Please sign in to comment.