mirror of
https://github.com/zulip/zulip.git
synced 2025-11-12 01:47:41 +00:00
Send a Tornado notification when activating users.
(imported from commit d51655979b3fb3929b3b4cb5e616c93016e7dc83)
This commit is contained in:
@@ -70,6 +70,15 @@ def log_event(event):
|
||||
with open(template % ('events',), 'a') as log:
|
||||
log.write(ujson.dumps(event) + '\n')
|
||||
|
||||
def notify_created_user(user_profile):
|
||||
notice = dict(event=dict(type="realm_user", op="add",
|
||||
person=dict(email=user_profile.email,
|
||||
full_name=user_profile.full_name)),
|
||||
users=[up.id for up in
|
||||
UserProfile.objects.select_related().filter(realm=user_profile.realm,
|
||||
is_active=True)])
|
||||
tornado_callbacks.send_notification(notice)
|
||||
|
||||
def do_create_user(email, password, realm, full_name, short_name,
|
||||
active=True, bot=False, bot_owner=None,
|
||||
avatar_source=UserProfile.AVATAR_FROM_GRAVATAR):
|
||||
@@ -87,13 +96,7 @@ def do_create_user(email, password, realm, full_name, short_name,
|
||||
user_profile = create_user(email, password, realm, full_name, short_name,
|
||||
active, bot, bot_owner, avatar_source)
|
||||
|
||||
notice = dict(event=dict(type="realm_user", op="add",
|
||||
person=dict(email=user_profile.email,
|
||||
full_name=user_profile.full_name)),
|
||||
users=[up.id for up in
|
||||
UserProfile.objects.select_related().filter(realm=user_profile.realm,
|
||||
is_active=True)])
|
||||
tornado_callbacks.send_notification(notice)
|
||||
notify_created_user(user_profile)
|
||||
return user_profile
|
||||
|
||||
def user_sessions(user_profile):
|
||||
@@ -724,6 +727,8 @@ def do_activate_user(user_profile, log=True, join_date=timezone.now()):
|
||||
'user': user_profile.email,
|
||||
'domain': domain})
|
||||
|
||||
notify_created_user(user_profile)
|
||||
|
||||
def do_change_password(user_profile, password, log=True, commit=True,
|
||||
hashed_password=False):
|
||||
if hashed_password:
|
||||
|
||||
Reference in New Issue
Block a user