2018-11-12 14:15:49 +01:00
|
|
|
from argparse import ArgumentParser
|
2020-01-14 21:59:46 +01:00
|
|
|
from typing import Any
|
2018-11-12 14:15:49 +01:00
|
|
|
|
|
|
|
from zerver.lib.actions import do_send_realm_reactivation_email
|
2020-01-14 21:59:46 +01:00
|
|
|
from zerver.lib.management import CommandError, ZulipBaseCommand
|
2018-11-12 14:15:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
class Command(ZulipBaseCommand):
|
|
|
|
help = """Sends realm reactivation email to admins"""
|
|
|
|
|
|
|
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
|
|
|
self.add_realm_args(parser, True)
|
|
|
|
|
|
|
|
def handle(self, *args: Any, **options: str) -> None:
|
|
|
|
realm = self.get_realm(options)
|
|
|
|
assert realm is not None
|
|
|
|
if not realm.deactivated:
|
2020-06-10 06:41:04 +02:00
|
|
|
raise CommandError(f"The realm {realm.name} is already active.")
|
2021-02-12 08:20:45 +01:00
|
|
|
print("Sending email to admins")
|
2018-11-12 14:15:49 +01:00
|
|
|
do_send_realm_reactivation_email(realm)
|
2021-02-12 08:20:45 +01:00
|
|
|
print("Done!")
|