bots: Pass realm to get_system_bot calls in stripe.

This commit is contained in:
Mateusz Mandera
2021-03-08 11:22:06 +01:00
committed by Tim Abbott
parent 57f14b247e
commit a3cd3d6865
2 changed files with 2 additions and 2 deletions

View File

@@ -887,7 +887,7 @@ def approve_sponsorship(realm: Realm, *, acting_user: Optional[UserProfile]) ->
event_type=RealmAuditLog.REALM_SPONSORSHIP_APPROVED, event_type=RealmAuditLog.REALM_SPONSORSHIP_APPROVED,
event_time=timezone_now(), event_time=timezone_now(),
) )
notification_bot = get_system_bot(settings.NOTIFICATION_BOT) notification_bot = get_system_bot(settings.NOTIFICATION_BOT, realm.id)
for user in realm.get_human_billing_admin_and_realm_owner_users(): for user in realm.get_human_billing_admin_and_realm_owner_users():
with override_language(user.default_language): with override_language(user.default_language):
# Using variable to make life easier for translators if these details change. # Using variable to make life easier for translators if these details change.

View File

@@ -1756,7 +1756,7 @@ class StripeTest(StripeTestCase):
self.assertEqual(realm.plan_type, Realm.STANDARD_FREE) self.assertEqual(realm.plan_type, Realm.STANDARD_FREE)
expected_message = "Your organization's request for sponsored hosting has been approved! :tada:.\nYou have been upgraded to Zulip Cloud Standard, free of charge." expected_message = "Your organization's request for sponsored hosting has been approved! :tada:.\nYou have been upgraded to Zulip Cloud Standard, free of charge."
sender = get_system_bot(settings.NOTIFICATION_BOT) sender = get_system_bot(settings.NOTIFICATION_BOT, user.realm_id)
recipient_id = self.example_user("desdemona").recipient_id recipient_id = self.example_user("desdemona").recipient_id
message = Message.objects.filter(sender=sender.id).first() message = Message.objects.filter(sender=sender.id).first()
assert message is not None assert message is not None