mirror of
https://github.com/zulip/zulip.git
synced 2025-11-09 00:18:12 +00:00
Use the event system to sync onboarding steps across browser tabs.
(imported from commit 29311390133aca8f3a3d79fbe06dbbcabc4fb6ea)
This commit is contained in:
committed by
Jessica McKellar
parent
976ceb2a1d
commit
a4c5c24029
@@ -772,6 +772,14 @@ def do_update_onboarding_steps(user_profile, steps):
|
|||||||
user_profile.onboarding_steps = simplejson.dumps(steps)
|
user_profile.onboarding_steps = simplejson.dumps(steps)
|
||||||
user_profile.save()
|
user_profile.save()
|
||||||
|
|
||||||
|
log_event({'type': 'update_onboarding',
|
||||||
|
'user': user_profile.email,
|
||||||
|
'steps': steps})
|
||||||
|
|
||||||
|
notice = dict(event=dict(type="onboarding_steps", steps=steps),
|
||||||
|
users=[user_profile.id])
|
||||||
|
tornado_callbacks.send_notification(notice)
|
||||||
|
|
||||||
def do_finish_tutorial(user_profile):
|
def do_finish_tutorial(user_profile):
|
||||||
user_profile.tutorial_status = UserProfile.TUTORIAL_FINISHED
|
user_profile.tutorial_status = UserProfile.TUTORIAL_FINISHED
|
||||||
user_profile.save()
|
user_profile.save()
|
||||||
@@ -863,6 +871,9 @@ def do_events_register(user_profile, user_client, apply_markdown=True,
|
|||||||
for profile in
|
for profile in
|
||||||
UserProfile.objects.select_related().filter(realm=user_profile.realm,
|
UserProfile.objects.select_related().filter(realm=user_profile.realm,
|
||||||
is_active=True)]
|
is_active=True)]
|
||||||
|
if event_types is None or "onboarding_steps" in event_types:
|
||||||
|
ret['onboarding_steps'] = [{'email' : profile.email,
|
||||||
|
'steps' : profile.onboarding_steps}]
|
||||||
if event_types is None or "subscription" in event_types:
|
if event_types is None or "subscription" in event_types:
|
||||||
ret['subscriptions'] = gather_subscriptions(user_profile)
|
ret['subscriptions'] = gather_subscriptions(user_profile)
|
||||||
if event_types is None or "presence" in event_types:
|
if event_types is None or "presence" in event_types:
|
||||||
@@ -875,6 +886,8 @@ def do_events_register(user_profile, user_client, apply_markdown=True,
|
|||||||
ret['max_message_id'] = max(ret['max_message_id'], event['message']['id'])
|
ret['max_message_id'] = max(ret['max_message_id'], event['message']['id'])
|
||||||
elif event['type'] == "pointer":
|
elif event['type'] == "pointer":
|
||||||
ret['pointer'] = max(ret['pointer'], event['pointer'])
|
ret['pointer'] = max(ret['pointer'], event['pointer'])
|
||||||
|
elif event['type'] == "onboarding_steps":
|
||||||
|
ret['onboarding_steps'] = event['steps']
|
||||||
elif event['type'] == "realm_user":
|
elif event['type'] == "realm_user":
|
||||||
if event['op'] == "add":
|
if event['op'] == "add":
|
||||||
ret['realm_users'].append(event['person'])
|
ret['realm_users'].append(event['person'])
|
||||||
|
|||||||
@@ -810,6 +810,9 @@ function get_updates(options) {
|
|||||||
case 'restart':
|
case 'restart':
|
||||||
reload.initiate();
|
reload.initiate();
|
||||||
break;
|
break;
|
||||||
|
case 'onboarding_steps':
|
||||||
|
onboarding.set_step_info(event.steps);
|
||||||
|
break;
|
||||||
case 'realm_user':
|
case 'realm_user':
|
||||||
if (event.op === 'add') {
|
if (event.op === 'add') {
|
||||||
add_person(event.person);
|
add_person(event.person);
|
||||||
|
|||||||
Reference in New Issue
Block a user