Skip to content

Commit b63aaab

Browse files
committed
✨ [#85] Notify assignees of successful deletion
1 parent ae061d7 commit b63aaab

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

backend/src/openarchiefbeheer/destruction/tasks.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from .constants import InternalStatus, ListItemStatus, ListStatus
1010
from .models import DestructionList, DestructionListItem, ReviewResponse
1111
from .signals import deletion_failure
12+
from .utils import notify_assignees_successful_deletion
1213

1314
logger = logging.getLogger(__name__)
1415

@@ -104,4 +105,4 @@ def complete_and_notify(pk: int) -> None:
104105

105106
destruction_list.set_status(ListStatus.deleted)
106107

107-
# TODO notify
108+
notify_assignees_successful_deletion(destruction_list)

backend/src/openarchiefbeheer/destruction/utils.py

+14
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,20 @@ def notify_author_last_review(
9999
)
100100

101101

102+
def notify_assignees_successful_deletion(destruction_list: DestructionList) -> None:
103+
config = EmailConfig.get_solo()
104+
recipients = destruction_list.assignees.all().values_list("user__email", flat=True)
105+
106+
notify(
107+
subject=config.subject_successful_deletion,
108+
body=config.body_successful_deletion,
109+
context={
110+
"list": destruction_list,
111+
},
112+
recipients=list(recipients),
113+
)
114+
115+
102116
class ObjectWithStatus(Protocol):
103117
def set_processing_status(self, status: InternalStatus) -> None: ...
104118

0 commit comments

Comments
 (0)