Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
actions: Create send_message_to_signup_notification_stream.
Vishnu KSe019045abefd
diff --git a/corporate/tests/test_stripe.py b/corporate/tests/test_stripe.pyindex 0e1c0b10884..6df00d0e277 100644--- a/corporate/tests/test_stripe.py+++ b/corporate/tests/test_stripe.py@@ -1815,12 +1815,15 @@ class StripeTest(StripeTestCase):mock_customer = Mock(email=user.delivery_email, default_source=None)with patch("corporate.views.stripe_get_customer", return_value=mock_customer):response = self.client_get("/billing/")- self.assert_in_success_response([- "Your plan will be downgraded to <strong>Zulip Limited</strong> on "- "<strong>January 2, 2013</strong>",- "You plan is scheduled for downgrade on <strong>January 2, 2013</strong>",- "Cancel downgrade",- ], response)+ self.assert_in_success_response(+ [+ "Your plan will be downgraded to <strong>Zulip Limited</strong> on "+ "<strong>January 2, 2013</strong>",+ "You plan is scheduled for downgrade on <strong>January 2, 2013</strong>",+ "Cancel downgrade",+ ],+ response,+ )# Verify that we still write LicenseLedger rows during the remaining# part of the cyclediff --git a/zerver/lib/actions.py b/zerver/lib/actions.pyindex c956f197aae..42abb6a2ba2 100644--- a/zerver/lib/actions.py+++ b/zerver/lib/actions.py@@ -344,20 +344,27 @@ def get_signups_stream(realm: Realm) -> Stream:return get_stream("signups", realm)-def notify_new_user(user_profile: UserProfile) -> None:- sender_email = settings.NOTIFICATION_BOT- sender = get_system_bot(sender_email)+def send_message_to_signup_notification_stream(+ sender: UserProfile, realm: Realm, message: str, topic_name: str = _("signups")+) -> None:+ signup_notifications_stream = realm.get_signup_notifications_stream()+ if signup_notifications_stream is None:+ return+ with override_language(realm.default_language):+ internal_send_stream_message(sender, signup_notifications_stream, topic_name, message)+++def notify_new_user(user_profile: UserProfile) -> None:user_count = realm_user_count(user_profile.realm)- signup_notifications_stream = user_profile.realm.get_signup_notifications_stream()- # Send notification to realm signup notifications stream if it exists- # Don't send notification for the first user in a realm- if signup_notifications_stream is not None and user_count > 1:- with override_language(user_profile.realm.default_language):- message = _("{user} just signed up for Zulip. (total: {user_count})").format(- user=f"@_**{user_profile.full_name}|{user_profile.id}**", user_count=user_count- )- internal_send_stream_message(sender, signup_notifications_stream, _("signups"), message)+ sender = get_system_bot(settings.NOTIFICATION_BOT)++ is_first_user = user_count == 1+ if not is_first_user:+ message = _("{user} just signed up for Zulip. (total: {user_count})").format(+ user=f"@_**{user_profile.full_name}|{user_profile.id}**", user_count=user_count+ )+ send_message_to_signup_notification_stream(sender, user_profile.realm, message)# We also send a notification to the Zulip administrative realmadmin_realm = sender.realm