Skip to content

Commit

Permalink
Merge pull request #2711 from carpentries/feature/2710-allow-editing-…
Browse files Browse the repository at this point in the history
…cancelled-emails

[Emails] Allow editing cancelled emails
  • Loading branch information
pbanaszkiewicz authored Nov 10, 2024
2 parents bec573f + afad78c commit 6d21bc1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions amy/emails/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ class ScheduledEmailStatus(models.TextChoices):
"edit": [
ScheduledEmailStatus.SCHEDULED,
ScheduledEmailStatus.FAILED,
ScheduledEmailStatus.CANCELLED,
],
"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 @@ -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"])
2 changes: 1 addition & 1 deletion amy/emails/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ def test_disallowed_email_statuses(self) -> None:
for state in [
ScheduledEmailStatus.LOCKED,
ScheduledEmailStatus.RUNNING,
ScheduledEmailStatus.CANCELLED,
ScheduledEmailStatus.SUCCEEDED,
]
]
)
Expand Down
2 changes: 1 addition & 1 deletion amy/templates/emails/scheduled_email_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ <h1>
{% if "edit" in available_status_actions %}
<a class="btn btn-primary" href="{% url 'scheduledemail_edit' scheduled_email.id %}">Edit</a>
{% else %}
<span class="d-inline-block" tabindex="0" data-toggle="tooltip" title="You can only edit emails that are in the 'scheduled', 'failed' or 'succeeded' states.">
<span class="d-inline-block" tabindex="0" data-toggle="tooltip" title="You can only edit emails that are in the 'scheduled', 'failed' or 'cancelled' states.">
<a class="btn btn-primary disabled" style="pointer-events:none" disabled href="#">Edit</a>
</span>
{% endif %}
Expand Down

0 comments on commit 6d21bc1

Please sign in to comment.