models: Replace core team with Realm.INITIAL_PRIVATE_STREAM_NAME.

This commit is contained in:
Vishnu Ks 2017-10-04 05:37:44 +05:30 committed by Tim Abbott
parent a0275a6257
commit 3d2c9c6098
5 changed files with 7 additions and 6 deletions

View File

@ -2821,7 +2821,7 @@ def do_create_realm(string_id, name, restricted_to_domain=None,
realm.notifications_stream = notifications_stream
signup_notifications_stream, _ = create_stream_if_needed(
realm, "core team", invite_only=True,
realm, Realm.INITIAL_PRIVATE_STREAM_NAME, invite_only=True,
stream_description="A private stream for core team members.")
realm.signup_notifications_stream = signup_notifications_stream

View File

@ -57,7 +57,7 @@ def send_initial_realm_messages(realm):
'topic': "welcome",
'content': "This is a message on stream `%s` with the topic `welcome`. We'll use this stream "
"for system-generated notifications." % (Realm.DEFAULT_NOTIFICATION_STREAM_NAME,)},
{'stream': "core team",
{'stream': Realm.INITIAL_PRIVATE_STREAM_NAME,
'topic': "private streams",
'content': "This is a private stream. Only admins and people you invite "
"to the stream will be able to see that this stream exists."},

View File

@ -206,6 +206,7 @@ class Realm(models.Model):
icon_version = models.PositiveSmallIntegerField(default=1) # type: int
DEFAULT_NOTIFICATION_STREAM_NAME = u'announce'
INITIAL_PRIVATE_STREAM_NAME = u'core team'
def authentication_methods_dict(self):
# type: () -> Dict[Text, bool]

View File

@ -4,7 +4,7 @@ from django.contrib.auth.signals import user_logged_in
from zerver.lib.test_classes import ZulipTestCase
from zerver.signals import get_device_browser, get_device_os
from zerver.lib.actions import notify_new_user
from zerver.models import Recipient, Stream
from zerver.models import Recipient, Stream, Realm
from zerver.lib.initial_password import initial_password
class SendLoginEmailTest(ZulipTestCase):
@ -129,7 +129,7 @@ class TestNotifyNewUser(ZulipTestCase):
def test_notify_realm_of_new_user(self) -> None:
new_user = self.example_user('cordelia')
stream = self.make_stream('core team')
stream = self.make_stream(Realm.INITIAL_PRIVATE_STREAM_NAME)
new_user.realm.signup_notifications_stream_id = stream.id
new_user.realm.save()
new_user = self.example_user('cordelia')
@ -138,4 +138,4 @@ class TestNotifyNewUser(ZulipTestCase):
message = self.get_last_message()
self.assertEqual(message.recipient.type, Recipient.STREAM)
actual_stream = Stream.objects.get(id=message.recipient.type_id)
self.assertEqual(actual_stream.name, 'core team')
self.assertEqual(actual_stream.name, Realm.INITIAL_PRIVATE_STREAM_NAME)

View File

@ -1265,7 +1265,7 @@ class RealmCreationTest(ZulipTestCase):
# Check welcome messages
for stream_name, text, message_count in [
('announce', 'This is', 1),
('core team', 'This is', 1),
(Realm.INITIAL_PRIVATE_STREAM_NAME, 'This is', 1),
('general', 'Welcome to', 1),
('new members', 'stream is', 1),
('zulip', 'Here is', 3)]: