2016-12-25 00:44:26 +01:00
|
|
|
|
2016-10-12 20:57:59 +02:00
|
|
|
from django.http import HttpRequest, HttpResponse
|
2018-04-24 03:47:28 +02:00
|
|
|
from typing import List
|
2016-10-12 20:57:59 +02:00
|
|
|
|
2017-11-04 00:59:22 +01:00
|
|
|
from zerver.decorator import has_request_variables, REQ, JsonableError
|
2016-10-12 20:57:59 +02:00
|
|
|
from zerver.lib.actions import check_send_typing_notification, \
|
|
|
|
extract_recipients
|
|
|
|
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'),
|
|
|
|
notification_to: List[str]=REQ('to', converter=extract_recipients, default=[]),
|
2017-12-18 15:07:43 +01:00
|
|
|
) -> HttpResponse:
|
2016-10-12 20:57:59 +02:00
|
|
|
check_send_typing_notification(user_profile, notification_to, operator)
|
|
|
|
return json_success()
|