From 1d22817ede8bfc8e9398a109f5b453544c6db310 Mon Sep 17 00:00:00 2001 From: pablohashescobar <118773738+pablohashescobar@users.noreply.github.com> Date: Tue, 2 May 2023 20:09:54 +0530 Subject: [PATCH] fix: import user invite emails (#986) --- apiserver/plane/bgtasks/importer_task.py | 4 +++- apiserver/plane/bgtasks/user_welcome_task.py | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/apiserver/plane/bgtasks/importer_task.py b/apiserver/plane/bgtasks/importer_task.py index b27787635..291b71be3 100644 --- a/apiserver/plane/bgtasks/importer_task.py +++ b/apiserver/plane/bgtasks/importer_task.py @@ -59,7 +59,9 @@ def service_importer(service, importer_id): [ send_welcome_email.delay( - user, True, f"{user.email} was imported to Plane from {service}" + str(user.id), + True, + f"{user.email} was imported to Plane from {service}", ) for user in new_users ] diff --git a/apiserver/plane/bgtasks/user_welcome_task.py b/apiserver/plane/bgtasks/user_welcome_task.py index cad2aed1a..c042d0a0b 100644 --- a/apiserver/plane/bgtasks/user_welcome_task.py +++ b/apiserver/plane/bgtasks/user_welcome_task.py @@ -10,9 +10,15 @@ from sentry_sdk import capture_exception from slack_sdk import WebClient from slack_sdk.errors import SlackApiError +# Module imports +from plane.db.models import User + + @shared_task -def send_welcome_email(instance, created, message): +def send_welcome_email(user_id, created, message): try: + instance = User.objects.get(pk=user_id) + if created and not instance.is_bot: first_name = instance.first_name.capitalize() to_email = instance.email