mirror of https://github.com/zulip/zulip.git
send_custom_email: Only send to long_term_idle users.
This commit is contained in:
parent
83f6557f43
commit
36d15d85e0
|
@ -3,7 +3,6 @@ from typing import Any
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.management.base import CommandError
|
from django.core.management.base import CommandError
|
||||||
from django.db.models import Q
|
|
||||||
|
|
||||||
from zerver.lib.management import ZulipBaseCommand
|
from zerver.lib.management import ZulipBaseCommand
|
||||||
from zerver.lib.send_email import send_custom_email
|
from zerver.lib.send_email import send_custom_email
|
||||||
|
@ -71,18 +70,15 @@ class Command(ZulipBaseCommand):
|
||||||
)
|
)
|
||||||
elif options["marketing"]:
|
elif options["marketing"]:
|
||||||
# Marketing email sent at most once to each email address for users
|
# Marketing email sent at most once to each email address for users
|
||||||
# who are either recently active (!long_term_idle) or are a realm owner.
|
# who are recently active (!long_term_idle) users of the product.
|
||||||
users = (
|
users = UserProfile.objects.filter(
|
||||||
UserProfile.objects.filter(
|
is_active=True,
|
||||||
is_active=True,
|
is_bot=False,
|
||||||
is_bot=False,
|
is_mirror_dummy=False,
|
||||||
is_mirror_dummy=False,
|
realm__deactivated=False,
|
||||||
realm__deactivated=False,
|
enable_marketing_emails=True,
|
||||||
enable_marketing_emails=True,
|
long_term_idle=False,
|
||||||
)
|
).distinct("delivery_email")
|
||||||
.filter(Q(long_term_idle=False) | Q(role=UserProfile.ROLE_REALM_OWNER))
|
|
||||||
.distinct("delivery_email")
|
|
||||||
)
|
|
||||||
elif options["all_sponsored_org_admins"]:
|
elif options["all_sponsored_org_admins"]:
|
||||||
# Sends at most one copy to each email address, even if it
|
# Sends at most one copy to each email address, even if it
|
||||||
# is an administrator in several organizations.
|
# is an administrator in several organizations.
|
||||||
|
|
Loading…
Reference in New Issue