models: Rename get_human_billing_admin_users to be more explicit.

This commit is contained in:
Vishnu KS 2021-07-02 14:46:47 +05:30 committed by Tim Abbott
parent e64296b3e9
commit cb64a19edf
2 changed files with 4 additions and 4 deletions

View File

@ -876,8 +876,8 @@ def approve_sponsorship(realm: Realm, *, acting_user: Optional[UserProfile]) ->
event_time=timezone_now(),
)
notification_bot = get_system_bot(settings.NOTIFICATION_BOT)
for billing_admin in realm.get_human_billing_admin_users():
with override_language(billing_admin.default_language):
for user in realm.get_human_billing_admin_and_realm_owner_users():
with override_language(user.default_language):
# Using variable to make life easier for translators if these details change.
plan_name = "Zulip Cloud Standard"
emoji = ":tada:"
@ -885,7 +885,7 @@ def approve_sponsorship(realm: Realm, *, acting_user: Optional[UserProfile]) ->
f"Your organization's request for sponsored hosting has been approved! {emoji}.\n"
f"You have been upgraded to {plan_name}, free of charge."
)
internal_send_private_message(notification_bot, billing_admin, message)
internal_send_private_message(notification_bot, user, message)
def is_sponsored_realm(realm: Realm) -> bool:

View File

@ -648,7 +648,7 @@ class Realm(models.Model):
role__in=roles,
)
def get_human_billing_admin_users(self) -> QuerySet:
def get_human_billing_admin_and_realm_owner_users(self) -> QuerySet:
return UserProfile.objects.filter(
Q(role=UserProfile.ROLE_REALM_OWNER) | Q(is_billing_admin=True),
realm=self,