fix: import user invite emails (#986)

This commit is contained in:
pablohashescobar 2023-05-02 20:09:54 +05:30 committed by GitHub
parent 483c49d0ff
commit 1d22817ede
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -59,7 +59,9 @@ def service_importer(service, importer_id):
[ [
send_welcome_email.delay( 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 for user in new_users
] ]

View File

@ -10,9 +10,15 @@ from sentry_sdk import capture_exception
from slack_sdk import WebClient from slack_sdk import WebClient
from slack_sdk.errors import SlackApiError from slack_sdk.errors import SlackApiError
# Module imports
from plane.db.models import User
@shared_task @shared_task
def send_welcome_email(instance, created, message): def send_welcome_email(user_id, created, message):
try: try:
instance = User.objects.get(pk=user_id)
if created and not instance.is_bot: if created and not instance.is_bot:
first_name = instance.first_name.capitalize() first_name = instance.first_name.capitalize()
to_email = instance.email to_email = instance.email