From a51d8d4251dbd4f1e8173e72cd956df162d6068e Mon Sep 17 00:00:00 2001 From: Rishi Gupta Date: Fri, 14 Jul 2017 20:06:58 -0700 Subject: [PATCH] realm creation: Change initial realm messages and streams. --- zerver/tests/test_signup.py | 13 +++++++++---- zerver/views/registration.py | 36 ++++++++++++++++++++++++------------ 2 files changed, 33 insertions(+), 16 deletions(-) diff --git a/zerver/tests/test_signup.py b/zerver/tests/test_signup.py index d3fdce83f6..341e3518a5 100644 --- a/zerver/tests/test_signup.py +++ b/zerver/tests/test_signup.py @@ -876,12 +876,17 @@ class RealmCreationTest(ZulipTestCase): self.assertTrue(result["Location"].endswith("/")) # Check welcome messages - for stream_name in ['general', 'social', 'zulip']: + for stream_name, text, message_count in [ + ('announce', 'This is', 1), + ('core team', 'This is', 1), + ('general', 'Welcome to', 1), + ('new members', 'stream is', 1), + ('zulip', 'Here is', 3)]: stream = get_stream(stream_name, realm) recipient = get_recipient(Recipient.STREAM, stream.id) - messages = Message.objects.filter(recipient=recipient) - self.assertEqual(len(messages), 1) - self.assertIn('Welcome to', messages[0].content) + messages = Message.objects.filter(recipient=recipient).order_by('pub_date') + self.assertEqual(len(messages), message_count) + self.assertIn(text, messages[0].content) def test_create_realm_existing_email(self): # type: () -> None diff --git a/zerver/views/registration.py b/zerver/views/registration.py index 8fe6eaee8f..2d1c8b26e7 100644 --- a/zerver/views/registration.py +++ b/zerver/views/registration.py @@ -78,12 +78,13 @@ Click anywhere on this message to reply. A compose box will open at the bottom o def setup_initial_streams(realm): # type: (Realm) -> None stream_dicts = [ - {'name': "general", - 'description': "For general stuff"}, - {'name': "social", - 'description': "For socializing"}, + {'name': "general"}, + {'name': "new members", + 'description': "For welcoming and onboarding new members. If you haven't yet, " + "introduce yourself in a new thread using your name as the topic!"}, {'name': "zulip", - 'description': "For zulip stuff"}] # type: List[Mapping[str, Any]] + 'description': "For discussing Zulip, Zulip tips and tricks, and asking " + "questions about how Zulip works"}] # type: List[Mapping[str, Any]] create_streams_if_needed(realm, stream_dicts) set_default_streams(realm, {stream['name']: {} for stream in stream_dicts}) @@ -107,16 +108,27 @@ def send_initial_realm_messages(realm): {'stream': "core team", 'topic': "private streams", 'content': "This is a private stream. Only admins and people you invite " - "will be able to see that this stream exists."}, + "to the stream will be able to see that this stream exists."}, {'stream': "general", - 'topic': "hello", + 'topic': "welcome", 'content': "Welcome to #**general**."}, - {'stream': "social", - 'topic': "hello", - 'content': "Welcome to #**social**."}, + {'stream': "new members", + 'topic': "onboarding", + 'content': "A #**new members** stream is great for onboarding new members.\n\nIf you're " + "reading this and aren't the first person here, introduce yourself in a new thread " + "using your name as the topic! Type `c` or click on `New Topic` at the bottom of the " + "screen to start a new topic."}, {'stream': "zulip", - 'topic': "hello", - 'content': "Welcome to #**zulip**."}, + 'topic': "topic demonstration", + 'content': "Here is a message in one topic. Replies to this message will go to this topic."}, + {'stream': "zulip", + 'topic': "topic demonstration", + 'content': "A second message in this topic."}, + {'stream': "zulip", + 'topic': "second topic", + 'content': "This is a message in a second topic.\n\nTopics are similar to email subjects, " + "in that each conversation should get its own topic. Keep them short, though; one " + "or two words will do it!"}, ] # type: List[Dict[str, Text]] messages = [internal_prep_stream_message( realm, get_system_bot(settings.WELCOME_BOT),