snapshot of https://github.com/zulip/zulip.git @ 48c69911c7dd4e03b20552eb3bd77ad8151c1357 (2026-09-15)
Some checks failed
Code scanning / CodeQL (push) Failing after 15s
Zulip production suite / Ubuntu 22.04 production build (push) Failing after 26s
Zulip production suite / Debian 12 production install with custom db name and user (push) Has been skipped
Zulip production suite / Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga (push) Has been skipped
Zulip production suite / Ubuntu 24.04 production install (push) Has been skipped
Zulip production suite / Ubuntu 26.04 production install (push) Has been skipped
Zulip production suite / Debian 13 production install (push) Has been skipped
Zulip production suite / 7.0 Version Upgrade (push) Has been skipped
Zulip production suite / 8.0 Version Upgrade (push) Has been skipped
Zulip production suite / 6.0 Version Upgrade (push) Has been skipped
Zulip production suite / 10.0 Version Upgrade (push) Has been skipped
Zulip production suite / 9.0 Version Upgrade (push) Has been skipped
Zulip production suite / 12.0 Version Upgrade (push) Has been skipped
Zulip production suite / 11.0 Version Upgrade (push) Has been skipped
GitHub Actions Security Analysis with zizmor / zizmor (push) Failing after 3s
Zulip CI / Debian 12 (Python 3.11, backend + documentation) (push) Failing after 26s
Zulip CI / Ubuntu 22.04 (Python 3.10, backend + frontend) (push) Failing after 3s
Zulip CI / Ubuntu 24.04 (Python 3.12, backend) (push) Failing after 25s
Zulip CI / Ubuntu 26.04 (Python 3.14, backend) (push) Failing after 25s
Zulip CI / Debian 13 (Python 3.13, backend) (push) Failing after 28s
Zulip production suite / Required jobs (push) Has been cancelled
Zulip CI / Required jobs (push) Has been cancelled
API Documentation Update Check / check-feature-level-updated (push) Has been cancelled
API Documentation Update Check / notify-if-api-docs-changed (push) Has been cancelled
Some checks failed
Code scanning / CodeQL (push) Failing after 15s
Zulip production suite / Ubuntu 22.04 production build (push) Failing after 26s
Zulip production suite / Debian 12 production install with custom db name and user (push) Has been skipped
Zulip production suite / Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga (push) Has been skipped
Zulip production suite / Ubuntu 24.04 production install (push) Has been skipped
Zulip production suite / Ubuntu 26.04 production install (push) Has been skipped
Zulip production suite / Debian 13 production install (push) Has been skipped
Zulip production suite / 7.0 Version Upgrade (push) Has been skipped
Zulip production suite / 8.0 Version Upgrade (push) Has been skipped
Zulip production suite / 6.0 Version Upgrade (push) Has been skipped
Zulip production suite / 10.0 Version Upgrade (push) Has been skipped
Zulip production suite / 9.0 Version Upgrade (push) Has been skipped
Zulip production suite / 12.0 Version Upgrade (push) Has been skipped
Zulip production suite / 11.0 Version Upgrade (push) Has been skipped
GitHub Actions Security Analysis with zizmor / zizmor (push) Failing after 3s
Zulip CI / Debian 12 (Python 3.11, backend + documentation) (push) Failing after 26s
Zulip CI / Ubuntu 22.04 (Python 3.10, backend + frontend) (push) Failing after 3s
Zulip CI / Ubuntu 24.04 (Python 3.12, backend) (push) Failing after 25s
Zulip CI / Ubuntu 26.04 (Python 3.14, backend) (push) Failing after 25s
Zulip CI / Debian 13 (Python 3.13, backend) (push) Failing after 28s
Zulip production suite / Required jobs (push) Has been cancelled
Zulip CI / Required jobs (push) Has been cancelled
API Documentation Update Check / check-feature-level-updated (push) Has been cancelled
API Documentation Update Check / notify-if-api-docs-changed (push) Has been cancelled
This commit is contained in:
61
zerver/views/onboarding_steps.py
Normal file
61
zerver/views/onboarding_steps.py
Normal file
@@ -0,0 +1,61 @@
|
||||
from datetime import timedelta
|
||||
|
||||
from django.conf import settings
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
from django.utils.timezone import now as timezone_now
|
||||
from django.utils.translation import gettext as _
|
||||
from pydantic import Json
|
||||
|
||||
from zerver.actions.onboarding_steps import do_mark_onboarding_step_as_read
|
||||
from zerver.actions.scheduled_messages import check_schedule_message
|
||||
from zerver.decorator import human_users_only
|
||||
from zerver.lib.exceptions import JsonableError
|
||||
from zerver.lib.onboarding_steps import ALL_ONBOARDING_STEPS
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.lib.typed_endpoint import typed_endpoint
|
||||
from zerver.models import UserProfile
|
||||
from zerver.models.clients import get_client
|
||||
from zerver.models.users import get_system_bot
|
||||
|
||||
|
||||
@human_users_only
|
||||
@typed_endpoint
|
||||
def mark_onboarding_step_as_read(
|
||||
request: HttpRequest,
|
||||
user: UserProfile,
|
||||
*,
|
||||
onboarding_step: str,
|
||||
schedule_navigation_tour_video_reminder_delay: Json[int] | None = None,
|
||||
) -> HttpResponse:
|
||||
if not any(step.name == onboarding_step for step in ALL_ONBOARDING_STEPS):
|
||||
raise JsonableError(
|
||||
_("Unknown onboarding_step: {onboarding_step}").format(onboarding_step=onboarding_step)
|
||||
)
|
||||
|
||||
if schedule_navigation_tour_video_reminder_delay is not None:
|
||||
assert onboarding_step == "navigation_tour_video"
|
||||
|
||||
realm = user.realm
|
||||
sender = get_system_bot(settings.WELCOME_BOT, realm.id)
|
||||
client = get_client("Internal")
|
||||
message_content = _("""
|
||||
You asked to watch the [Welcome to Zulip video]({navigation_tour_video_url}) later. Is this a good time?
|
||||
""").format(navigation_tour_video_url=settings.NAVIGATION_TOUR_VIDEO_URL)
|
||||
deliver_at = timezone_now() + timedelta(
|
||||
seconds=schedule_navigation_tour_video_reminder_delay
|
||||
)
|
||||
|
||||
check_schedule_message(
|
||||
sender,
|
||||
client,
|
||||
"private",
|
||||
[user.id],
|
||||
None,
|
||||
message_content,
|
||||
deliver_at,
|
||||
realm,
|
||||
skip_events=True,
|
||||
)
|
||||
|
||||
do_mark_onboarding_step_as_read(user, onboarding_step)
|
||||
return json_success(request)
|
||||
Reference in New Issue
Block a user