mirror of https://github.com/zulip/zulip.git
realm creation: Move sending of initial notifications stream message.
Slowly collecting all initial realm messages into send_initial_realm_messages, so that it is easy to control their order.
This commit is contained in:
parent
377e32d77c
commit
70d77c7251
|
@ -2292,22 +2292,6 @@ def do_create_realm(string_id, name, restricted_to_domain=None,
|
|||
realm.notifications_stream = notifications_stream
|
||||
realm.save(update_fields=['notifications_stream'])
|
||||
|
||||
# Include a welcome message in this notifications stream
|
||||
stream_name = notifications_stream.name
|
||||
sender = get_system_bot(settings.WELCOME_BOT)
|
||||
topic = "welcome"
|
||||
content = """\
|
||||
This is a message on stream `%s` with the topic `welcome`. We'll use this stream for
|
||||
system-generated notifications.""" % (stream_name,)
|
||||
|
||||
msg = internal_prep_stream_message(
|
||||
realm=realm,
|
||||
sender=sender,
|
||||
stream_name=stream_name,
|
||||
topic=topic,
|
||||
content=content)
|
||||
do_send_messages([msg])
|
||||
|
||||
# Log the event
|
||||
log_event({"type": "realm_created",
|
||||
"string_id": string_id,
|
||||
|
|
|
@ -97,6 +97,10 @@ def setup_initial_private_stream(user):
|
|||
def send_initial_realm_messages(realm):
|
||||
# type: (Realm) -> None
|
||||
welcome_messages = [
|
||||
{'stream': Realm.DEFAULT_NOTIFICATION_STREAM_NAME,
|
||||
'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",
|
||||
'topic': "private streams",
|
||||
'content': "This is a private stream. Only admins and people you invite "
|
||||
|
|
Loading…
Reference in New Issue