mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	send_email: Fix modification of mutable default value.
This commit is contained in:
		@@ -17,8 +17,8 @@ class FromAddress(object):
 | 
			
		||||
 | 
			
		||||
# Intended only for test code
 | 
			
		||||
def build_email(template_prefix, to_user_id=None, to_email=None, from_name=None,
 | 
			
		||||
                from_address=None, reply_to_email=None, context={}):
 | 
			
		||||
    # type: (str, Optional[int], Optional[Text], Optional[Text], Optional[Text], Optional[Text], Dict[str, Any]) -> EmailMultiAlternatives
 | 
			
		||||
                from_address=None, reply_to_email=None, context=None):
 | 
			
		||||
    # type: (str, Optional[int], Optional[Text], Optional[Text], Optional[Text], Optional[Text], Optional[Dict[str, Any]]) -> EmailMultiAlternatives
 | 
			
		||||
    # Callers should pass exactly one of to_user_id and to_email.
 | 
			
		||||
    assert (to_user_id is None) ^ (to_email is None)
 | 
			
		||||
    if to_user_id is not None:
 | 
			
		||||
@@ -27,6 +27,9 @@ def build_email(template_prefix, to_user_id=None, to_email=None, from_name=None,
 | 
			
		||||
        # https://github.com/zulip/zulip/issues/4676 is resolved
 | 
			
		||||
        to_email = to_user.email
 | 
			
		||||
 | 
			
		||||
    if context is None:
 | 
			
		||||
        context = {}
 | 
			
		||||
 | 
			
		||||
    context.update({
 | 
			
		||||
        'realm_name_in_notifications': False,
 | 
			
		||||
        'support_email': FromAddress.SUPPORT,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user