zerver: Migrate several small files to typed_endpoint.

Migrate "submessage.py", "thumbnail.py", "tutorial.py", "zephyr.py" and
"dev_login.py" to `typed_endpoint`.
This commit is contained in:
Kenneth Rodrigues
2024-06-29 00:44:00 +05:30
committed by Tim Abbott
parent defd6748d6
commit fe2097fd26
5 changed files with 26 additions and 21 deletions

View File

@@ -1,15 +1,16 @@
from django.http import HttpRequest, HttpResponse
from typing_extensions import Literal
from zerver.decorator import human_users_only
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.typed_endpoint import typed_endpoint
from zerver.models import UserProfile
@human_users_only
@has_request_variables
@typed_endpoint
def set_tutorial_status(
request: HttpRequest, user_profile: UserProfile, status: str = REQ()
request: HttpRequest, user_profile: UserProfile, *, status: Literal["started", "finished"]
) -> HttpResponse:
if status == "started":
user_profile.tutorial_status = UserProfile.TUTORIAL_STARTED