mirror of https://github.com/zulip/zulip.git
emails: Move verbose_support_offers into a common context.
Server settings should just be added to the context in build_email, so that the individual email pathways (and later, the email testing framework) doesn't have to worry about it.
This commit is contained in:
parent
c3aa799192
commit
056489c247
|
@ -34,7 +34,6 @@ def confirm(request, confirmation_key):
|
|||
'key': confirmation_key,
|
||||
'full_name': request.GET.get("full_name", None),
|
||||
'support_email': settings.ZULIP_ADMINISTRATOR,
|
||||
'verbose_support_offers': settings.VERBOSE_SUPPORT_OFFERS,
|
||||
}
|
||||
templates = [
|
||||
'confirmation/confirm.html',
|
||||
|
|
|
@ -632,7 +632,6 @@ def do_start_email_change_process(user_profile, new_email):
|
|||
user_profile.email = new_email
|
||||
|
||||
context = {'support_email': settings.ZULIP_ADMINISTRATOR,
|
||||
'verbose_support_offers': settings.VERBOSE_SUPPORT_OFFERS,
|
||||
'realm': user_profile.realm,
|
||||
'old_email': old_email,
|
||||
'new_email': new_email,
|
||||
|
@ -3055,8 +3054,7 @@ def do_send_confirmation_email(invitee, referrer, body):
|
|||
`referrer` is a UserProfile.
|
||||
"""
|
||||
context = {'referrer': referrer,
|
||||
'support_email': settings.ZULIP_ADMINISTRATOR,
|
||||
'verbose_support_offers': settings.VERBOSE_SUPPORT_OFFERS}
|
||||
'support_email': settings.ZULIP_ADMINISTRATOR}
|
||||
|
||||
if referrer.realm.is_zephyr_mirror_realm:
|
||||
template_prefix = 'zerver/emails/invitation_mit'
|
||||
|
|
|
@ -404,7 +404,6 @@ def enqueue_welcome_emails(email, name):
|
|||
unsubscribe_link = one_click_unsubscribe_link(user_profile, "welcome")
|
||||
context = common_context(user_profile)
|
||||
context.update({
|
||||
'verbose_support_offers': settings.VERBOSE_SUPPORT_OFFERS,
|
||||
'unsubscribe_link': unsubscribe_link
|
||||
})
|
||||
send_future_email(
|
||||
|
|
|
@ -19,6 +19,9 @@ def display_email(user):
|
|||
# Intended only for test code
|
||||
def build_email(template_prefix, to_email, from_email=None, reply_to_email=None, context={}):
|
||||
# type: (str, Text, Optional[Text], Optional[Text], Dict[str, Any]) -> EmailMultiAlternatives
|
||||
context.update({
|
||||
'verbose_support_offers': settings.VERBOSE_SUPPORT_OFFERS,
|
||||
})
|
||||
subject = loader.render_to_string(template_prefix + '.subject',
|
||||
context=context, using='Jinja2_plaintext').strip()
|
||||
message = loader.render_to_string(template_prefix + '.txt',
|
||||
|
|
|
@ -739,7 +739,6 @@ so we didn't send them an invitation. We did send invitations to everyone else!"
|
|||
'referrer_name': referrer.full_name,
|
||||
'referrer_email': referrer.email,
|
||||
'referrer_realm_name': referrer.realm.name,
|
||||
'verbose_support_offers': settings.VERBOSE_SUPPORT_OFFERS,
|
||||
'support_email': settings.ZULIP_ADMINISTRATOR
|
||||
})
|
||||
with self.settings(EMAIL_BACKEND='django.core.mail.backends.console.EmailBackend'):
|
||||
|
|
|
@ -308,8 +308,7 @@ def send_registration_completion_email(email, request, realm_creation=False):
|
|||
template_prefix = 'zerver/emails/confirm_registration_mit'
|
||||
|
||||
prereg_user = create_preregistration_user(email, request, realm_creation)
|
||||
context = {'support_email': settings.ZULIP_ADMINISTRATOR,
|
||||
'verbose_support_offers': settings.VERBOSE_SUPPORT_OFFERS}
|
||||
context = {'support_email': settings.ZULIP_ADMINISTRATOR}
|
||||
return Confirmation.objects.send_confirmation(prereg_user, template_prefix, email,
|
||||
additional_context=context,
|
||||
host=request.get_host())
|
||||
|
|
|
@ -49,7 +49,6 @@ def confirm_email_change(request, confirmation_key):
|
|||
do_change_user_email(obj.user_profile, obj.new_email)
|
||||
|
||||
context = {'support_email': settings.ZULIP_ADMINISTRATOR,
|
||||
'verbose_support_offers': settings.VERBOSE_SUPPORT_OFFERS,
|
||||
'realm': obj.realm,
|
||||
'new_email': new_email,
|
||||
}
|
||||
|
@ -59,7 +58,6 @@ def confirm_email_change(request, confirmation_key):
|
|||
ctx = {
|
||||
'confirmed': confirmed,
|
||||
'support_email': settings.ZULIP_ADMINISTRATOR,
|
||||
'verbose_support_offers': settings.VERBOSE_SUPPORT_OFFERS,
|
||||
'new_email': new_email,
|
||||
'old_email': old_email,
|
||||
}
|
||||
|
|
|
@ -174,7 +174,6 @@ class ConfirmationEmailWorker(QueueProcessingWorker):
|
|||
'referrer_name': referrer.full_name,
|
||||
'referrer_email': referrer.email,
|
||||
'referrer_realm_name': referrer.realm.name,
|
||||
'verbose_support_offers': settings.VERBOSE_SUPPORT_OFFERS,
|
||||
'support_email': settings.ZULIP_ADMINISTRATOR
|
||||
})
|
||||
send_future_email(
|
||||
|
|
Loading…
Reference in New Issue