2024-08-08 08:30:52 +02:00
|
|
|
from django.db import transaction
|
|
|
|
|
2024-05-10 16:17:04 +02:00
|
|
|
from zerver.lib.onboarding_steps import get_next_onboarding_steps
|
2023-12-01 08:20:48 +01:00
|
|
|
from zerver.models import OnboardingStep, UserProfile
|
2024-08-08 08:30:52 +02:00
|
|
|
from zerver.tornado.django_api import send_event_on_commit
|
2022-04-14 23:33:30 +02:00
|
|
|
|
|
|
|
|
2024-08-08 08:30:52 +02:00
|
|
|
@transaction.atomic(durable=True)
|
2023-12-01 11:52:41 +01:00
|
|
|
def do_mark_onboarding_step_as_read(user: UserProfile, onboarding_step: str) -> None:
|
|
|
|
OnboardingStep.objects.get_or_create(user=user, onboarding_step=onboarding_step)
|
2023-12-02 11:30:35 +01:00
|
|
|
event = dict(type="onboarding_steps", onboarding_steps=get_next_onboarding_steps(user))
|
2024-08-08 08:30:52 +02:00
|
|
|
send_event_on_commit(user.realm, event, [user.id])
|