mirror of
https://github.com/zulip/zulip.git
synced 2025-11-11 09:27:43 +00:00
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:
@@ -2292,22 +2292,6 @@ def do_create_realm(string_id, name, restricted_to_domain=None,
|
|||||||
realm.notifications_stream = notifications_stream
|
realm.notifications_stream = notifications_stream
|
||||||
realm.save(update_fields=['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 the event
|
||||||
log_event({"type": "realm_created",
|
log_event({"type": "realm_created",
|
||||||
"string_id": string_id,
|
"string_id": string_id,
|
||||||
|
|||||||
@@ -97,6 +97,10 @@ def setup_initial_private_stream(user):
|
|||||||
def send_initial_realm_messages(realm):
|
def send_initial_realm_messages(realm):
|
||||||
# type: (Realm) -> None
|
# type: (Realm) -> None
|
||||||
welcome_messages = [
|
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",
|
{'stream': "core team",
|
||||||
'topic': "private streams",
|
'topic': "private streams",
|
||||||
'content': "This is a private stream. Only admins and people you invite "
|
'content': "This is a private stream. Only admins and people you invite "
|
||||||
|
|||||||
Reference in New Issue
Block a user