mirror of
https://github.com/zulip/zulip.git
synced 2025-11-16 11:52:01 +00:00
onboarding: Simplify get_turtle_message.
This commit is contained in:
@@ -5,8 +5,7 @@ from zerver.lib.actions import \
|
|||||||
internal_prep_stream_message_by_name, internal_send_private_message, \
|
internal_prep_stream_message_by_name, internal_send_private_message, \
|
||||||
do_send_messages, \
|
do_send_messages, \
|
||||||
do_add_reaction_legacy, create_users, missing_any_realm_internal_bots
|
do_add_reaction_legacy, create_users, missing_any_realm_internal_bots
|
||||||
from zerver.lib.topic import get_turtle_message
|
from zerver.models import Message, Realm, UserProfile, get_system_bot
|
||||||
from zerver.models import Realm, UserProfile, get_system_bot
|
|
||||||
|
|
||||||
from typing import Dict, List
|
from typing import Dict, List
|
||||||
|
|
||||||
@@ -97,5 +96,7 @@ def send_initial_realm_messages(realm: Realm) -> None:
|
|||||||
# We find the one of our just-sent messages with turtle.png in it,
|
# We find the one of our just-sent messages with turtle.png in it,
|
||||||
# and react to it. This is a bit hacky, but works and is kinda a
|
# and react to it. This is a bit hacky, but works and is kinda a
|
||||||
# 1-off thing.
|
# 1-off thing.
|
||||||
turtle_message = get_turtle_message(message_ids=message_ids)
|
turtle_message = Message.objects.get(
|
||||||
|
id__in=message_ids,
|
||||||
|
content__icontains='cute/turtle.png')
|
||||||
do_add_reaction_legacy(welcome_bot, turtle_message, 'turtle')
|
do_add_reaction_legacy(welcome_bot, turtle_message, 'turtle')
|
||||||
|
|||||||
@@ -225,12 +225,3 @@ def get_topic_history_for_web_public_stream(recipient: Recipient) -> List[Dict[s
|
|||||||
cursor.close()
|
cursor.close()
|
||||||
|
|
||||||
return generate_topic_history_from_db_rows(rows)
|
return generate_topic_history_from_db_rows(rows)
|
||||||
|
|
||||||
def get_turtle_message(message_ids: List[int]) -> Message:
|
|
||||||
# This is used for onboarding, and it's only extracted
|
|
||||||
# here to make subject -> topic sweeping easier.
|
|
||||||
turtle_message = Message.objects.get( # nolint
|
|
||||||
id__in=message_ids,
|
|
||||||
subject='topic demonstration',
|
|
||||||
content__icontains='cute/turtle.png')
|
|
||||||
return turtle_message
|
|
||||||
|
|||||||
Reference in New Issue
Block a user