Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
onboarding: Update initial direct message content.
Prakhar Pratyush5bb66e6c9924
diff --git a/zerver/lib/onboarding.py b/zerver/lib/onboarding.pyindex 5fb5e511983..c5716c1047c 100644--- a/zerver/lib/onboarding.py+++ b/zerver/lib/onboarding.py@@ -53,11 +53,11 @@ def send_initial_direct_message(user: UserProfile) -> int:with override_language(user.default_language):if education_organization:getting_started_string = _("""-If you are new to Zulip, check out our [Using Zulip for a class guide]({getting_started_url})!+To learn more, check out our [Using Zulip for a class guide]({getting_started_url})!""").format(getting_started_url="/help/using-zulip-for-a-class")else:getting_started_string = _("""-If you are new to Zulip, check out our [Getting started guide]({getting_started_url})!+To learn more, check out our [Getting started guide]({getting_started_url})!""").format(getting_started_url="/help/getting-started-with-zulip")organization_setup_string = ""@@ -80,8 +80,15 @@ Note that this is a [demo organization]({demo_organization_help_url}) andwill be **automatically deleted** in 30 days.""").format(demo_organization_help_url="/help/demo-organizations")+ inform_about_tracked_onboarding_messages_text = ""+ if OnboardingUserMessage.objects.filter(realm_id=user.realm_id).exists():+ inform_about_tracked_onboarding_messages_text = _("""+I've kicked off some conversations to help you get started. You can find+them in your [Inbox](/#inbox).+""")+content = _("""-Hello, and welcome to Zulip!👋 This is a direct message from me, Welcome Bot.+Hello, and welcome to Zulip!👋 {inform_about_tracked_onboarding_messages_text}{getting_started_text} {organization_setup_text}@@ -91,6 +98,7 @@ I can also help you get set up! Just click anywhere on this message or press `r`Here are a few messages I understand: {bot_commands}""").format(+ inform_about_tracked_onboarding_messages_text=inform_about_tracked_onboarding_messages_text,getting_started_text=getting_started_string,organization_setup_text=organization_setup_string,demo_organization_text=demo_organization_warning_string,diff --git a/zerver/tests/test_signup.py b/zerver/tests/test_signup.pyindex 62c4fb10e5b..699b0916f99 100644--- a/zerver/tests/test_signup.py+++ b/zerver/tests/test_signup.py@@ -1046,7 +1046,7 @@ class LoginTest(ZulipTestCase):# seem to be any O(N) behavior. Some of the cache hits are related# to sending messages, such as getting the welcome bot, looking up# the alert words for a realm, etc.- with self.assert_database_query_count(93), self.assert_memcached_count(14):+ with self.assert_database_query_count(94), self.assert_memcached_count(14):with self.captureOnCommitCallbacks(execute=True):self.register(self.nonreg_email("test"), "test")@@ -1731,8 +1731,9 @@ class RealmCreationTest(ZulipTestCase):self.assertEqual(result.status_code, 302)# Make sure the correct Welcome Bot direct message is sent.+ realm = get_realm(string_id)welcome_msg = Message.objects.filter(- realm_id=get_realm(string_id).id,+ realm_id=realm.id,sender__email="[email protected]",recipient__type=Recipient.PERSONAL,).latest("id")@@ -1744,6 +1745,22 @@ class RealmCreationTest(ZulipTestCase):self.assertNotIn("Using Zulip for a class guide", welcome_msg.content)self.assertNotIn("demo organization", welcome_msg.content)+ # Organization has tracked onboarding messages.+ self.assertTrue(OnboardingUserMessage.objects.filter(realm_id=realm.id).exists())+ self.assertIn("I've kicked off some conversations", welcome_msg.content)++ # Verify that Organization without 'OnboardingUserMessage' records+ # doesn't include "I've kicked off..." text in welcome_msg content.+ OnboardingUserMessage.objects.filter(realm_id=realm.id).delete()+ do_create_user("hamlet", "password", realm, "hamlet", acting_user=None)+ welcome_msg = Message.objects.filter(+ realm_id=realm.id,+ sender__email="[email protected]",+ recipient__type=Recipient.PERSONAL,+ ).latest("id")+ self.assertTrue(welcome_msg.content.startswith("Hello, and welcome to Zulip!"))+ self.assertNotIn("I've kicked off some conversations", welcome_msg.content)+@override_settings(OPEN_REALM_CREATION=True)def test_create_education_demo_organization_welcome_bot_direct_message(self) -> None:password = "test"diff --git a/zerver/tests/test_users.py b/zerver/tests/test_users.pyindex 21e3db828a1..8cdb993f40e 100644--- a/zerver/tests/test_users.py+++ b/zerver/tests/test_users.py@@ -908,7 +908,7 @@ class QueryCountTest(ZulipTestCase):prereg_user = PreregistrationUser.objects.get(email="[email protected]")- with self.assert_database_query_count(83):+ with self.assert_database_query_count(84):with self.assert_memcached_count(19):with self.capture_send_event_calls(expected_num_events=10) as events:fred = do_create_user(