mirror of
https://github.com/zulip/zulip.git
synced 2026-07-15 21:03:26 +08:00
Enable digest emails for zulip.com.
(imported from commit f676f96c2b516b33269b8f5c72deaf5c985e8ccd)
This commit is contained in:
parent
8bb1caec8f
commit
71f5b4e0ae
@ -5,7 +5,7 @@ import pytz
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
from zerver.lib.queue import queue_json_publish
|
||||
from zerver.models import UserActivity, get_user_profile_by_email
|
||||
from zerver.models import UserActivity, UserProfile, get_realm
|
||||
|
||||
VALID_DIGEST_DAYS = (1, 2, 3)
|
||||
def inactive_since(user_profile, cutoff):
|
||||
@ -47,9 +47,12 @@ in a while.
|
||||
if datetime.datetime.utcnow().weekday() not in VALID_DIGEST_DAYS:
|
||||
return
|
||||
|
||||
for email in ["jesstess@zulip.com", "jessica.mckellar@gmail.com",
|
||||
"sipbtest@mit.edu", "jesstess+si@zulip.com"]:
|
||||
user_profile = get_user_profile_by_email(email)
|
||||
cutoff = last_business_day()
|
||||
if inactive_since(user_profile, cutoff):
|
||||
queue_digest_recipient(user_profile, cutoff)
|
||||
for domain in ["zulip.com"]:
|
||||
user_profiles = UserProfile.objects.filter(
|
||||
realm=get_realm(domain), is_active=True, is_bot=False,
|
||||
enable_digest_emails=True)
|
||||
|
||||
for user_profile in user_profiles:
|
||||
cutoff = last_business_day()
|
||||
if inactive_since(user_profile, cutoff):
|
||||
queue_digest_recipient(user_profile, cutoff)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user