2020-02-28 18:23:57 +01:00
|
|
|
from typing import List
|
2016-10-12 20:57:59 +02:00
|
|
|
|
2020-06-11 00:54:34 +02:00
|
|
|
from django.http import HttpRequest, HttpResponse
|
|
|
|
|
|
|
|
from zerver.decorator import REQ, has_request_variables
|
2020-02-28 18:23:57 +01:00
|
|
|
from zerver.lib.actions import check_send_typing_notification
|
2016-10-12 20:57:59 +02:00
|
|
|
from zerver.lib.response import json_success
|
2020-02-28 18:23:57 +01:00
|
|
|
from zerver.lib.validator import check_int, check_list
|
2016-10-12 20:57:59 +02:00
|
|
|
from zerver.models import UserProfile
|
|
|
|
|
2020-06-11 00:54:34 +02:00
|
|
|
|
2016-10-12 20:57:59 +02:00
|
|
|
@has_request_variables
|
2017-12-18 15:07:43 +01:00
|
|
|
def send_notification_backend(
|
2021-02-12 08:19:30 +01:00
|
|
|
request: HttpRequest,
|
|
|
|
user_profile: UserProfile,
|
2021-02-12 08:20:45 +01:00
|
|
|
operator: str = REQ("op"),
|
|
|
|
notification_to: List[int] = REQ("to", validator=check_list(check_int)),
|
2021-02-12 08:19:30 +01:00
|
|
|
) -> HttpResponse:
|
2016-10-12 20:57:59 +02:00
|
|
|
check_send_typing_notification(user_profile, notification_to, operator)
|
|
|
|
return json_success()
|