2016-10-12 20:57:59 +02:00
|
|
|
from django.http import HttpRequest, HttpResponse
|
2019-08-07 10:42:16 +02:00
|
|
|
from typing import List, Union
|
2016-10-12 20:57:59 +02:00
|
|
|
|
2019-02-02 23:53:22 +01:00
|
|
|
from zerver.decorator import has_request_variables, REQ
|
2016-10-12 20:57:59 +02:00
|
|
|
from zerver.lib.actions import check_send_typing_notification, \
|
2020-02-11 21:28:14 +01:00
|
|
|
extract_private_recipients
|
2016-10-12 20:57:59 +02:00
|
|
|
from zerver.lib.response import json_success
|
|
|
|
from zerver.models import UserProfile
|
|
|
|
|
|
|
|
@has_request_variables
|
2017-12-18 15:07:43 +01:00
|
|
|
def send_notification_backend(
|
|
|
|
request: HttpRequest, user_profile: UserProfile,
|
2018-04-24 03:47:28 +02:00
|
|
|
operator: str=REQ('op'),
|
2019-08-07 10:42:16 +02:00
|
|
|
notification_to: Union[List[str], List[int]]=REQ(
|
2020-02-11 21:28:14 +01:00
|
|
|
'to', type=Union[List[str], List[int]],
|
|
|
|
converter=extract_private_recipients, default=[])) -> HttpResponse:
|
2016-10-12 20:57:59 +02:00
|
|
|
check_send_typing_notification(user_profile, notification_to, operator)
|
|
|
|
return json_success()
|