From 209ed65ebca281d375c3f8be7b12c1f05f49b7e1 Mon Sep 17 00:00:00 2001 From: Son Nguyen Kim Date: Mon, 10 Jun 2024 13:58:04 +0200 Subject: [PATCH] Disable pgp onboarding proton mail (#2122) * show app page * Do not send onboarding PGP email to Proton mailbox --------- Co-authored-by: Son NK --- job_runner.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/job_runner.py b/job_runner.py index 6674964a6..90b018ab4 100644 --- a/job_runner.py +++ b/job_runner.py @@ -198,13 +198,18 @@ def process_job(job: Job): onboarding_mailbox(user) elif job.name == config.JOB_ONBOARDING_4: user_id = job.payload.get("user_id") - user = User.get(user_id) + user: User = User.get(user_id) # user might delete their account in the meantime # or disable the notification if user and user.notification and user.activated: - LOG.d("send onboarding pgp email to user %s", user) - onboarding_pgp(user) + # if user only has 1 mailbox which is Proton then do not send PGP onboarding email + mailboxes = user.mailboxes() + if len(mailboxes) == 1 and mailboxes[0].is_proton(): + LOG.d("Do not send onboarding PGP email to Proton mailbox") + else: + LOG.d("send onboarding pgp email to user %s", user) + onboarding_pgp(user) elif job.name == config.JOB_BATCH_IMPORT: batch_import_id = job.payload.get("batch_import_id")