mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	As noted in the previous commit, this decorator is not just used for "notify" endpoints anymore.
		
			
				
	
	
		
			21 lines
		
	
	
		
			650 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
		
			650 B
		
	
	
	
		
			Python
		
	
	
	
	
	
from django.http import HttpRequest, HttpResponse
 | 
						|
 | 
						|
from zerver.decorator import internal_api_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_api_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)
 |