mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
Adds request as a parameter to json_success as a refactor towards making `ignored_parameters_unsupported` functionality available for all API endpoints. Also, removes any data parameters that are an empty dict or a dict with the generic success response values.
21 lines
656 B
Python
21 lines
656 B
Python
from django.http import HttpRequest, HttpResponse
|
|
|
|
from zerver.decorator import internal_notify_view
|
|
from zerver.lib.email_mirror import mirror_email_message
|
|
from zerver.lib.exceptions import JsonableError
|
|
from zerver.lib.request import REQ, has_request_variables
|
|
from zerver.lib.response import json_success
|
|
|
|
|
|
@internal_notify_view(False)
|
|
@has_request_variables
|
|
def email_mirror_message(
|
|
request: HttpRequest,
|
|
rcpt_to: str = REQ(),
|
|
msg_base64: str = REQ(),
|
|
) -> HttpResponse:
|
|
result = mirror_email_message(rcpt_to, msg_base64)
|
|
if result["status"] == "error":
|
|
raise JsonableError(result["msg"])
|
|
return json_success(request)
|