From 7b52fb885d55dfce830f04f906e84646efd87a5e Mon Sep 17 00:00:00 2001 From: pablohashescobar <118773738+pablohashescobar@users.noreply.github.com> Date: Mon, 15 May 2023 19:37:40 +0530 Subject: [PATCH] remove: onboarding emails (#1050) * remove: user onboarding mail * remove: welcome emails --- apiserver/plane/bgtasks/importer_task.py | 4 +- apiserver/plane/bgtasks/user_welcome_task.py | 25 +- apiserver/plane/db/models/user.py | 22 +- .../emails/auth/user_welcome_email.html | 481 ------------------ 4 files changed, 4 insertions(+), 528 deletions(-) delete mode 100644 apiserver/templates/emails/auth/user_welcome_email.html diff --git a/apiserver/plane/bgtasks/importer_task.py b/apiserver/plane/bgtasks/importer_task.py index 27410966f..85ac1c89b 100644 --- a/apiserver/plane/bgtasks/importer_task.py +++ b/apiserver/plane/bgtasks/importer_task.py @@ -27,7 +27,7 @@ from plane.db.models import ( User, ) from .workspace_invitation_task import workspace_invitation -from plane.bgtasks.user_welcome_task import send_welcome_email +from plane.bgtasks.user_welcome_task import send_welcome_slack @shared_task @@ -58,7 +58,7 @@ def service_importer(service, importer_id): ) [ - send_welcome_email.delay( + send_welcome_slack.delay( str(user.id), True, f"{user.email} was imported to Plane from {service}", diff --git a/apiserver/plane/bgtasks/user_welcome_task.py b/apiserver/plane/bgtasks/user_welcome_task.py index c042d0a0b..bea2ee33d 100644 --- a/apiserver/plane/bgtasks/user_welcome_task.py +++ b/apiserver/plane/bgtasks/user_welcome_task.py @@ -1,8 +1,5 @@ # Django imports from django.conf import settings -from django.core.mail import EmailMultiAlternatives -from django.template.loader import render_to_string -from django.utils.html import strip_tags # Third party imports from celery import shared_task @@ -15,31 +12,11 @@ from plane.db.models import User @shared_task -def send_welcome_email(user_id, created, message): +def send_welcome_slack(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 - from_email_string = settings.EMAIL_FROM - - subject = f"Welcome to Plane ✈️!" - - context = {"first_name": first_name, "email": instance.email} - - html_content = render_to_string( - "emails/auth/user_welcome_email.html", context - ) - - text_content = strip_tags(html_content) - - msg = EmailMultiAlternatives( - subject, text_content, from_email_string, [to_email] - ) - msg.attach_alternative(html_content, "text/html") - msg.send() - # Send message on slack as well if settings.SLACK_BOT_TOKEN: client = WebClient(token=settings.SLACK_BOT_TOKEN) diff --git a/apiserver/plane/db/models/user.py b/apiserver/plane/db/models/user.py index 5a4f487c1..b0ab72159 100644 --- a/apiserver/plane/db/models/user.py +++ b/apiserver/plane/db/models/user.py @@ -104,29 +104,9 @@ class User(AbstractBaseUser, PermissionsMixin): @receiver(post_save, sender=User) -def send_welcome_email(sender, instance, created, **kwargs): +def send_welcome_slack(sender, instance, created, **kwargs): try: if created and not instance.is_bot: - first_name = instance.first_name.capitalize() - to_email = instance.email - from_email_string = settings.EMAIL_FROM - - subject = f"Welcome to Plane ✈️!" - - context = {"first_name": first_name, "email": instance.email} - - html_content = render_to_string( - "emails/auth/user_welcome_email.html", context - ) - - text_content = strip_tags(html_content) - - msg = EmailMultiAlternatives( - subject, text_content, from_email_string, [to_email] - ) - msg.attach_alternative(html_content, "text/html") - msg.send() - # Send message on slack as well if settings.SLACK_BOT_TOKEN: client = WebClient(token=settings.SLACK_BOT_TOKEN) diff --git a/apiserver/templates/emails/auth/user_welcome_email.html b/apiserver/templates/emails/auth/user_welcome_email.html deleted file mode 100644 index af4e60d99..000000000 --- a/apiserver/templates/emails/auth/user_welcome_email.html +++ /dev/null @@ -1,481 +0,0 @@ - - - - - - - - - Welcome to Plane ✈️! - - - - - - - - - - - - - - - - - - \ No newline at end of file