refactor: Making onboarding independent of actions.

Moved missing_any_realm_internal_bots from actions.py to
onboarding.py since it wa only being used by it.
This commit is contained in:
Udit107710
2020-03-28 09:02:45 +00:00
committed by Tim Abbott
parent a076bcb9f4
commit cc542a607e
2 changed files with 11 additions and 10 deletions

View File

@@ -5742,15 +5742,6 @@ def check_delete_user_group(user_group_id: int, user_profile: UserProfile) -> No
user_group.delete()
do_send_delete_user_group_event(user_profile.realm, user_group_id, user_profile.realm.id)
def missing_any_realm_internal_bots() -> bool:
bot_emails = [bot['email_template'] % (settings.INTERNAL_BOT_DOMAIN,)
for bot in settings.REALM_INTERNAL_BOTS]
bot_counts = dict(UserProfile.objects.filter(email__in=bot_emails)
.values_list('email')
.annotate(Count('id')))
realm_count = Realm.objects.count()
return any(bot_counts.get(email, 0) < realm_count for email in bot_emails)
def do_send_realm_reactivation_email(realm: Realm) -> None:
url = create_confirmation_link(realm, realm.host, Confirmation.REALM_REACTIVATION)
context = {'confirmation_url': url,