emails: Add a FromAddress class to control access to certain settings emails.

No change in behavior.

Also makes the first step towards converting all uses of
settings.ZULIP_ADMINISTRATOR and settings.NOREPLY_EMAIL_ADDRESS to
FromAddress.*.

Once everything is converted, it will be easier to ensure that future
development doesn't break backwards compatibility with the old style of
settings emails.
This commit is contained in:
James Rowan
2017-06-26 13:43:32 -04:00
committed by Tim Abbott
parent 368bd66d8b
commit d88e7308bf
7 changed files with 19 additions and 16 deletions

View File

@@ -27,7 +27,7 @@ from zerver.lib.actions import do_send_confirmation_email, \
render_incoming_message, do_update_embedded_data
from zerver.lib.url_preview import preview as url_preview
from zerver.lib.digest import handle_digest_email
from zerver.lib.send_email import send_future_email, send_email_from_dict
from zerver.lib.send_email import send_future_email, send_email_from_dict, FromAddress
from zerver.lib.email_mirror import process_message as mirror_email
from zerver.decorator import JsonableError
from zerver.tornado.socket import req_redis_key
@@ -180,7 +180,7 @@ class ConfirmationEmailWorker(QueueProcessingWorker):
send_future_email(
"zerver/emails/invitation_reminder",
data["email"],
from_address=settings.ZULIP_ADMINISTRATOR.split()[-1],
from_address=FromAddress.SUPPORT,
context=context,
delay=datetime.timedelta(days=2))