mirror of
https://github.com/zulip/zulip.git
synced 2025-11-15 11:22:04 +00:00
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:
@@ -5742,15 +5742,6 @@ def check_delete_user_group(user_group_id: int, user_profile: UserProfile) -> No
|
|||||||
user_group.delete()
|
user_group.delete()
|
||||||
do_send_delete_user_group_event(user_profile.realm, user_group_id, user_profile.realm.id)
|
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:
|
def do_send_realm_reactivation_email(realm: Realm) -> None:
|
||||||
url = create_confirmation_link(realm, realm.host, Confirmation.REALM_REACTIVATION)
|
url = create_confirmation_link(realm, realm.host, Confirmation.REALM_REACTIVATION)
|
||||||
context = {'confirmation_url': url,
|
context = {'confirmation_url': url,
|
||||||
|
|||||||
@@ -1,14 +1,24 @@
|
|||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.db.models import Count
|
||||||
|
|
||||||
from zerver.lib.actions import \
|
from zerver.lib.actions import \
|
||||||
internal_prep_stream_message_by_name, internal_send_private_message, \
|
internal_prep_stream_message_by_name, internal_send_private_message, \
|
||||||
do_send_messages, \
|
do_send_messages, \
|
||||||
do_add_reaction, create_users, missing_any_realm_internal_bots
|
do_add_reaction, create_users
|
||||||
from zerver.lib.emoji import emoji_name_to_emoji_code
|
from zerver.lib.emoji import emoji_name_to_emoji_code
|
||||||
from zerver.models import Message, Realm, UserProfile, get_system_bot
|
from zerver.models import Message, Realm, UserProfile, get_system_bot
|
||||||
|
|
||||||
from typing import Dict, List
|
from typing import Dict, List
|
||||||
|
|
||||||
|
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 setup_realm_internal_bots(realm: Realm) -> None:
|
def setup_realm_internal_bots(realm: Realm) -> None:
|
||||||
"""Create this realm's internal bots.
|
"""Create this realm's internal bots.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user