models: Replace ScheduledJob with ScheduledEmail.

ScheduledJob was written for much more generality than it ended up being
used for. Currently it is used by send_future_email, and nothing
else. Tailoring the model to emails in particular will make it easier to do
things like selectively clear emails when people unsubscribe from particular
email types, or seamlessly handle using the same email on multiple realms.
This commit is contained in:
Rishi Gupta
2017-07-02 12:10:41 -07:00
committed by Tim Abbott
parent dd58406f03
commit aa845e7f60
14 changed files with 100 additions and 51 deletions

View File

@@ -209,7 +209,7 @@ def handle_digest_email(user_profile_id, cutoff):
if enough_traffic(context["unread_pms"], context["hot_conversations"],
new_streams_count, new_users_count):
logger.info("Sending digest email for %s" % (user_profile.email,))
# Send now, as a ScheduledJob
# Send now, as a ScheduledEmail
send_future_email('zerver/emails/digest', to_user_id=user_profile.id,
from_name="Zulip Digest", from_address=FromAddress.NOREPLY,
context=context)