Skip to content

Commit

Permalink
Allow to select wether we want to send the deletion email when deleti…
Browse files Browse the repository at this point in the history
…ng a mailbox
  • Loading branch information
acasajus committed Nov 28, 2024
1 parent f1b2edf commit 9cc6f33
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/mailbox_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ def create_mailbox(


def delete_mailbox(
user: User, mailbox_id: int, transfer_mailbox_id: Optional[int]
user: User,
mailbox_id: int,
transfer_mailbox_id: Optional[int],
send_mail: bool = True,
) -> Mailbox:
mailbox = Mailbox.get(mailbox_id)

Expand Down Expand Up @@ -150,6 +153,7 @@ def delete_mailbox(
"transfer_mailbox_id": transfer_mailbox_id
if transfer_mailbox_id and transfer_mailbox_id > 0
else None,
"send_mail": send_mail,
},
run_at=arrow.now(),
commit=True,
Expand Down
2 changes: 2 additions & 0 deletions job_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ def delete_mailbox_job(job: Job):
Session.commit()
LOG.d("Mailbox %s %s deleted", mailbox_id, mailbox_email)

if not job.payload.get("send_mail", True):
return
if alias_transferred_to:
send_email(
user.email,
Expand Down

0 comments on commit 9cc6f33

Please sign in to comment.