emails: Set correct language for email in send_email_to_admins.

Previously the emails were translated to the default_language of
admin[0] in build_email function. Now we use realm.default_language
instead.
This commit is contained in:
Vishnu KS 2020-02-19 12:48:03 +05:30 committed by Tim Abbott
parent 94d4bcd4ec
commit a2781e6364
2 changed files with 6 additions and 3 deletions

View File

@ -5920,10 +5920,12 @@ def do_send_realm_reactivation_email(realm: Realm) -> None:
context = {'confirmation_url': url,
'realm_uri': realm.uri,
'realm_name': realm.name}
language = realm.default_language
send_email_to_admins(
'zerver/emails/realm_reactivation', realm,
from_address=FromAddress.tokenized_no_reply_address(),
from_name="Zulip Account Security", context=context)
from_name=FromAddress.security_email_from_name(language=language),
language=language, context=context)
def get_zoom_video_call_url(realm: Realm) -> str:
response = request_zoom_video_call_url(

View File

@ -197,11 +197,12 @@ def send_future_email(template_prefix: str, realm: Realm, to_user_ids: Optional[
raise e
def send_email_to_admins(template_prefix: str, realm: Realm, from_name: Optional[str]=None,
from_address: Optional[str]=None, context: Dict[str, Any]={}) -> None:
from_address: Optional[str]=None, language: Optional[str]=None,
context: Dict[str, Any]={}) -> None:
admins = realm.get_human_admin_users()
admin_user_ids = [admin.id for admin in admins]
send_email(template_prefix, to_user_ids=admin_user_ids, from_name=from_name,
from_address=from_address, context=context)
from_address=from_address, language=language, context=context)
def clear_scheduled_invitation_emails(email: str) -> None:
"""Unlike most scheduled emails, invitation emails don't have an