mirror of https://github.com/zulip/zulip.git
management: Delete turn_off_digests command.
This command was part of early prototyping of the digests feature, and in particular its purpose is better served via the organization-level setting to control digest emails for the organization. Fixes part of #18898.
This commit is contained in:
parent
461c6bd791
commit
785895c265
|
@ -1,34 +0,0 @@
|
|||
from django.core.management.base import CommandParser
|
||||
|
||||
from zerver.lib.actions import do_change_notification_settings
|
||||
from zerver.lib.management import ZulipBaseCommand
|
||||
|
||||
|
||||
class Command(ZulipBaseCommand):
|
||||
help = """Turn off digests for a subdomain/string_id or specified set of email addresses."""
|
||||
|
||||
def add_arguments(self, parser: CommandParser) -> None:
|
||||
self.add_realm_args(parser)
|
||||
|
||||
self.add_user_list_args(
|
||||
parser,
|
||||
help="Turn off digests for this comma-separated list of email addresses.",
|
||||
all_users_help="Turn off digests for everyone in realm.",
|
||||
)
|
||||
|
||||
def handle(self, **options: str) -> None:
|
||||
realm = self.get_realm(options)
|
||||
user_profiles = self.get_users(options, realm)
|
||||
|
||||
print("Turned off digest emails for:")
|
||||
for user_profile in user_profiles:
|
||||
already_disabled_prefix = ""
|
||||
if user_profile.enable_digest_emails:
|
||||
do_change_notification_settings(
|
||||
user_profile, "enable_digest_emails", False, acting_user=None
|
||||
)
|
||||
else:
|
||||
already_disabled_prefix = "(already off) "
|
||||
print(
|
||||
f"{already_disabled_prefix}{user_profile.full_name} <{user_profile.delivery_email}>"
|
||||
)
|
Loading…
Reference in New Issue