Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

send_custom_email: Never email users who haven't agreed to ToS.

Tim Abbott323152c5fdc1
diff --git a/zerver/management/commands/send_custom_email.py b/zerver/management/commands/send_custom_email.py
index 5947fd5b99f..3dc2c79ad38 100644
--- a/zerver/management/commands/send_custom_email.py
+++ b/zerver/management/commands/send_custom_email.py
@@ -1,6 +1,8 @@
from argparse import ArgumentParser
from typing import Any
+from django.conf import settings
+
from zerver.lib.management import CommandError, ZulipBaseCommand
from zerver.lib.send_email import send_custom_email
from zerver.models import Realm, UserProfile
@@ -86,6 +88,9 @@ class Command(ZulipBaseCommand):
)
raise error
+ # Only email users who've agreed to the terms of service.
+ if settings.TOS_VERSION is not None:
+ users = users.exclude(tos_version=None)
send_custom_email(users, options)
if options["dry_run"]: