forked from github/plane
dev: remove ping
This commit is contained in:
parent
b4fb9f1aa2
commit
510eeb7a8f
@ -60,15 +60,6 @@ def service_importer(service, importer_id):
|
|||||||
batch_size=100,
|
batch_size=100,
|
||||||
)
|
)
|
||||||
|
|
||||||
_ = [
|
|
||||||
send_welcome_slack.delay(
|
|
||||||
str(user.id),
|
|
||||||
True,
|
|
||||||
f"{user.email} was imported to Plane from {service}",
|
|
||||||
)
|
|
||||||
for user in new_users
|
|
||||||
]
|
|
||||||
|
|
||||||
workspace_users = User.objects.filter(
|
workspace_users = User.objects.filter(
|
||||||
email__in=[
|
email__in=[
|
||||||
user.get("email").strip().lower()
|
user.get("email").strip().lower()
|
||||||
|
@ -12,15 +12,9 @@ from django.contrib.auth.models import (
|
|||||||
PermissionsMixin,
|
PermissionsMixin,
|
||||||
)
|
)
|
||||||
from django.db.models.signals import post_save
|
from django.db.models.signals import post_save
|
||||||
from django.conf import settings
|
|
||||||
from django.dispatch import receiver
|
from django.dispatch import receiver
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
# Third party imports
|
|
||||||
from sentry_sdk import capture_exception
|
|
||||||
from slack_sdk import WebClient
|
|
||||||
from slack_sdk.errors import SlackApiError
|
|
||||||
|
|
||||||
|
|
||||||
def get_default_onboarding():
|
def get_default_onboarding():
|
||||||
return {
|
return {
|
||||||
@ -144,25 +138,6 @@ class User(AbstractBaseUser, PermissionsMixin):
|
|||||||
super(User, self).save(*args, **kwargs)
|
super(User, self).save(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
@receiver(post_save, sender=User)
|
|
||||||
def send_welcome_slack(sender, instance, created, **kwargs):
|
|
||||||
try:
|
|
||||||
if created and not instance.is_bot:
|
|
||||||
# Send message on slack as well
|
|
||||||
if settings.SLACK_BOT_TOKEN:
|
|
||||||
client = WebClient(token=settings.SLACK_BOT_TOKEN)
|
|
||||||
try:
|
|
||||||
_ = client.chat_postMessage(
|
|
||||||
channel="#trackers",
|
|
||||||
text=f"New user {instance.email} has signed up and begun the onboarding journey.",
|
|
||||||
)
|
|
||||||
except SlackApiError as e:
|
|
||||||
print(f"Got an error: {e.response['error']}")
|
|
||||||
return
|
|
||||||
except Exception as e:
|
|
||||||
capture_exception(e)
|
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
@receiver(post_save, sender=User)
|
@receiver(post_save, sender=User)
|
||||||
def create_user_notification(sender, instance, created, **kwargs):
|
def create_user_notification(sender, instance, created, **kwargs):
|
||||||
|
Loading…
Reference in New Issue
Block a user