Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
actions: Rename *topic local variables to *topic_name.
Prakhar Pratyush1eef052bd1a9
diff --git a/zerver/actions/create_realm.py b/zerver/actions/create_realm.pyindex ca38c889a61..82b991fcc40 100644--- a/zerver/actions/create_realm.py+++ b/zerver/actions/create_realm.py@@ -319,7 +319,7 @@ def do_create_realm(support_link=support_url,type=organization_type,)- topic = "new organizations"+ topic_name = "new organizations"try:signups_stream = get_signups_stream(admin_realm)@@ -327,7 +327,7 @@ def do_create_realm(internal_send_stream_message(sender,signups_stream,- topic,+ topic_name,message,)except Stream.DoesNotExist: # nocoveragediff --git a/zerver/actions/message_edit.py b/zerver/actions/message_edit.pyindex ecb45b6a6bf..92c9e3a8117 100644--- a/zerver/actions/message_edit.py+++ b/zerver/actions/message_edit.py@@ -123,8 +123,8 @@ def maybe_send_resolve_topic_notifications(*,user_profile: UserProfile,stream: Stream,- old_topic: str,- new_topic: str,+ old_topic_name: str,+ new_topic_name: str,changed_messages: List[Message],) -> Optional[int]:"""Returns resolved_topic_message_id if resolve topic notifications were in fact sent."""@@ -132,12 +132,12 @@ def maybe_send_resolve_topic_notifications(## This logic is designed to treat removing a weird "✔ ✔✔ "# prefix as unresolving the topic.- topic_resolved: bool = new_topic.startswith(RESOLVED_TOPIC_PREFIX) and not old_topic.startswith(+ topic_resolved: bool = new_topic_name.startswith(RESOLVED_TOPIC_PREFIX- )- topic_unresolved: bool = old_topic.startswith(+ ) and not old_topic_name.startswith(RESOLVED_TOPIC_PREFIX)+ topic_unresolved: bool = old_topic_name.startswith(RESOLVED_TOPIC_PREFIX- ) and not new_topic.startswith(RESOLVED_TOPIC_PREFIX)+ ) and not new_topic_name.startswith(RESOLVED_TOPIC_PREFIX)if not topic_resolved and not topic_unresolved:# If there's some other weird topic that does not toggle the@@ -174,7 +174,7 @@ def maybe_send_resolve_topic_notifications(resolved_topic_message_id = internal_send_stream_message(sender,stream,- new_topic,+ new_topic_name,notification_string.format(user=user_mention,),@@ -188,10 +188,10 @@ def send_message_moved_breadcrumbs(target_message: Message,user_profile: UserProfile,old_stream: Stream,- old_topic: str,+ old_topic_name: str,old_thread_notification_string: Optional[StrPromise],new_stream: Stream,- new_topic: Optional[str],+ new_topic_name: Optional[str],new_thread_notification_string: Optional[StrPromise],changed_messages_count: int,) -> None:@@ -200,17 +200,17 @@ def send_message_moved_breadcrumbs(# happened.sender = get_system_bot(settings.NOTIFICATION_BOT, old_stream.realm_id)- if new_topic is None:- new_topic = old_topic+ if new_topic_name is None:+ new_topic_name = old_topic_nameuser_mention = silent_mention_syntax_for_user(user_profile)- old_topic_link = f"#**{old_stream.name}>{old_topic}**"- new_topic_link = f"#**{new_stream.name}>{new_topic}**"+ old_topic_link = f"#**{old_stream.name}>{old_topic_name}**"+ new_topic_link = f"#**{new_stream.name}>{new_topic_name}**"message = {"id": target_message.id,"stream_id": new_stream.id,"display_recipient": new_stream.name,- "topic": new_topic,+ "topic": new_topic_name,}moved_message_link = near_stream_message_url(target_message.realm, message)@@ -219,7 +219,7 @@ def send_message_moved_breadcrumbs(internal_send_stream_message(sender,new_stream,- new_topic,+ new_topic_name,new_thread_notification_string.format(message_link=moved_message_link,old_location=old_topic_link,@@ -234,7 +234,7 @@ def send_message_moved_breadcrumbs(internal_send_stream_message(sender,old_stream,- old_topic,+ old_topic_name,old_thread_notification_string.format(user=user_mention,new_location=new_topic_link,@@ -619,11 +619,11 @@ def do_update_message(assert orig_topic_name is not Nonetarget_stream: Stream = new_stream if new_stream is not None else stream_being_edited- target_topic: str = topic_name if topic_name is not None else orig_topic_name+ target_topic_name: str = topic_name if topic_name is not None else orig_topic_nameassert target_stream.recipient_id is not Nonetarget_topic_has_messages = messages_for_topic(- realm.id, target_stream.recipient_id, target_topic+ realm.id, target_stream.recipient_id, target_topic_name).exists()if propagate_mode in ["change_later", "change_all"]:@@ -837,7 +837,7 @@ def do_update_message(if moved_all_visible_messages:assert stream_being_edited is not Noneassert target_stream is not None- assert target_topic is not None+ assert target_topic_name is not Nonestream_inaccessible_to_user_profiles: List[UserProfile] = []orig_topic_user_profile_to_visibility_policy: Dict[UserProfile, int] = {}@@ -853,7 +853,7 @@ def do_update_message(] = user_topic.visibility_policyfor user_topic in get_users_with_user_topic_visibility_policy(- target_stream.id, target_topic+ target_stream.id, target_topic_name):target_topic_user_profile_to_visibility_policy[user_topic.user_profile@@ -950,7 +950,7 @@ def do_update_message(bulk_do_set_user_topic_visibility_policy(user_profiles,target_stream,- target_topic,+ target_topic_name,visibility_policy=new_visibility_policy,)else:@@ -965,7 +965,7 @@ def do_update_message(bulk_do_set_user_topic_visibility_policy(user_profiles,target_stream,- target_topic,+ target_topic_name,visibility_policy=new_visibility_policy,)@@ -985,8 +985,8 @@ def do_update_message(resolved_topic_message_id = maybe_send_resolve_topic_notifications(user_profile=user_profile,stream=stream_to_send_resolve_topic_notification,- old_topic=orig_topic_name,- new_topic=topic_name,+ old_topic_name=orig_topic_name,+ new_topic_name=topic_name,changed_messages=changed_messages,)@@ -1035,7 +1035,7 @@ def do_update_message(stream_for_new_topic = new_stream if new_stream is not None else stream_being_editedassert stream_for_new_topic.recipient_id is not None- new_topic = topic_name if topic_name is not None else orig_topic_name+ new_topic_name = topic_name if topic_name is not None else orig_topic_namechanged_message_ids = [changed_message.id for changed_message in changed_messages]@@ -1054,7 +1054,7 @@ def do_update_message(# it reuses existing logic, which is good for keeping it# correct as we maintain the codebase.preexisting_topic_messages = messages_for_topic(- realm.id, stream_for_new_topic.recipient_id, new_topic+ realm.id, stream_for_new_topic.recipient_id, new_topic_name).exclude(id__in=[*changed_message_ids, resolved_topic_message_id])visible_preexisting_messages = bulk_access_messages(diff --git a/zerver/actions/message_send.py b/zerver/actions/message_send.pyindex c18147361dd..f2fbee8b34a 100644--- a/zerver/actions/message_send.py+++ b/zerver/actions/message_send.py@@ -969,7 +969,7 @@ def do_send_messages(do_set_user_topic_visibility_policy(user_profile=sender,stream=send_request.stream,- topic=send_request.message.topic_name(),+ topic_name=send_request.message.topic_name(),visibility_policy=new_visibility_policy,)send_request.automatic_new_visibility_policy = new_visibility_policy@@ -1011,7 +1011,7 @@ def do_send_messages(bulk_do_set_user_topic_visibility_policy(user_profiles=to_follow_users,stream=send_request.stream,- topic=send_request.message.topic_name(),+ topic_name=send_request.message.topic_name(),visibility_policy=UserTopic.VisibilityPolicy.FOLLOWED,)@@ -1327,13 +1327,13 @@ def check_send_stream_message(sender: UserProfile,client: Client,stream_name: str,- topic: str,+ topic_name: str,body: str,*,realm: Optional[Realm] = None,read_by_sender: bool = False,) -> int:- addressee = Addressee.for_stream_name(stream_name, topic)+ addressee = Addressee.for_stream_name(stream_name, topic_name)message = check_message(sender, client, addressee, body, realm)sent_message_result = do_send_messages([message], mark_as_read=[sender.id] if read_by_sender else []@@ -1345,11 +1345,11 @@ def check_send_stream_message_by_id(sender: UserProfile,client: Client,stream_id: int,- topic: str,+ topic_name: str,body: str,realm: Optional[Realm] = None,) -> int:- addressee = Addressee.for_stream_id(stream_id, topic)+ addressee = Addressee.for_stream_id(stream_id, topic_name)message = check_message(sender, client, addressee, body, realm)sent_message_result = do_send_messages([message])[0]return sent_message_result.message_id@@ -1638,7 +1638,7 @@ def check_message(recipients_for_user_creation_events = Noneif addressee.is_stream():- topic_name = addressee.topic()+ topic_name = addressee.topic_name()topic_name = truncate_topic(topic_name)stream_name = addressee.stream_name()@@ -1840,7 +1840,7 @@ def _internal_prep_message(def internal_prep_stream_message(sender: UserProfile,stream: Stream,- topic: str,+ topic_name: str,content: str,*,email_gateway: bool = False,@@ -1850,7 +1850,7 @@ def internal_prep_stream_message(See _internal_prep_message for details of how this works."""realm = stream.realm- addressee = Addressee.for_stream(stream, topic)+ addressee = Addressee.for_stream(stream, topic_name)return _internal_prep_message(realm=realm,@@ -1866,13 +1866,13 @@ def internal_prep_stream_message_by_name(realm: Realm,sender: UserProfile,stream_name: str,- topic: str,+ topic_name: str,content: str,) -> Optional[SendMessageRequest]:"""See _internal_prep_message for details of how this works."""- addressee = Addressee.for_stream_name(stream_name, topic)+ addressee = Addressee.for_stream_name(stream_name, topic_name)return _internal_prep_message(realm=realm,@@ -1931,7 +1931,7 @@ def internal_send_private_message(def internal_send_stream_message(sender: UserProfile,stream: Stream,- topic: str,+ topic_name: str,content: str,*,email_gateway: bool = False,@@ -1940,7 +1940,7 @@ def internal_send_stream_message(message = internal_prep_stream_message(sender,stream,- topic,+ topic_name,content,email_gateway=email_gateway,limit_unread_user_ids=limit_unread_user_ids,@@ -1957,14 +1957,14 @@ def internal_send_stream_message_by_name(realm: Realm,sender: UserProfile,stream_name: str,- topic: str,+ topic_name: str,content: str,) -> Optional[int]:message = internal_prep_stream_message_by_name(realm,sender,stream_name,- topic,+ topic_name,content,)diff --git a/zerver/actions/reactions.py b/zerver/actions/reactions.pyindex 6d5331c945b..9aa3aef3c66 100644--- a/zerver/actions/reactions.py+++ b/zerver/actions/reactions.py@@ -112,7 +112,7 @@ def do_add_reaction(do_set_user_topic_visibility_policy(user_profile=user_profile,stream=stream,- topic=message.topic_name(),+ topic_name=message.topic_name(),visibility_policy=new_visibility_policy,)diff --git a/zerver/actions/scheduled_messages.py b/zerver/actions/scheduled_messages.pyindex c7be7b679b7..1c455eddbdb 100644--- a/zerver/actions/scheduled_messages.py+++ b/zerver/actions/scheduled_messages.py@@ -174,11 +174,11 @@ def edit_scheduled_message(# Update topic name if changed.if topic_name is not None:- updated_topic = topic_name+ updated_topic_name = topic_nameelse:# This will be ignored in Addressee.legacy_build if type# is being changed from stream to direct.- updated_topic = scheduled_message_object.topic_name()+ updated_topic_name = scheduled_message_object.topic_name()# Update message content if changed.if message_content is not None:@@ -188,7 +188,7 @@ def edit_scheduled_message(# Check message again.addressee = Addressee.legacy_build(- sender, updated_recipient_type_name, updated_recipient, updated_topic+ sender, updated_recipient_type_name, updated_recipient, updated_topic_name)send_request = check_message(sender,diff --git a/zerver/actions/streams.py b/zerver/actions/streams.pyindex 53251558eb3..d202e753d17 100644--- a/zerver/actions/streams.py+++ b/zerver/actions/streams.py@@ -311,7 +311,7 @@ def do_unarchive_stream(internal_send_stream_message(sender,stream,- str(Realm.STREAM_EVENTS_NOTIFICATION_TOPIC),+ str(Realm.STREAM_EVENTS_NOTIFICATION_TOPIC_NAME),_("Stream {stream_name} un-archived.").format(stream_name=new_name),)@@ -1184,7 +1184,7 @@ def send_change_stream_permission_notification(new_policy=new_policy_name,)internal_send_stream_message(- sender, stream, str(Realm.STREAM_EVENTS_NOTIFICATION_TOPIC), notification_string+ sender, stream, str(Realm.STREAM_EVENTS_NOTIFICATION_TOPIC_NAME), notification_string)@@ -1361,7 +1361,7 @@ def send_change_stream_post_policy_notification(new_policy=Stream.POST_POLICIES[new_post_policy],)internal_send_stream_message(- sender, stream, str(Realm.STREAM_EVENTS_NOTIFICATION_TOPIC), notification_string+ sender, stream, str(Realm.STREAM_EVENTS_NOTIFICATION_TOPIC_NAME), notification_string)@@ -1465,7 +1465,7 @@ def do_rename_stream(stream: Stream, new_name: str, user_profile: UserProfile) -internal_send_stream_message(sender,stream,- str(Realm.STREAM_EVENTS_NOTIFICATION_TOPIC),+ str(Realm.STREAM_EVENTS_NOTIFICATION_TOPIC_NAME),_("{user_name} renamed stream {old_stream_name} to {new_stream_name}.").format(user_name=silent_mention_syntax_for_user(user_profile),old_stream_name=f"**{old_name}**",@@ -1499,7 +1499,7 @@ def send_change_stream_description_notification()internal_send_stream_message(- sender, stream, str(Realm.STREAM_EVENTS_NOTIFICATION_TOPIC), notification_string+ sender, stream, str(Realm.STREAM_EVENTS_NOTIFICATION_TOPIC_NAME), notification_string)@@ -1583,7 +1583,7 @@ def send_change_stream_message_retention_days_notification(summary_line=summary_line,)internal_send_stream_message(- sender, stream, str(Realm.STREAM_EVENTS_NOTIFICATION_TOPIC), notification_string+ sender, stream, str(Realm.STREAM_EVENTS_NOTIFICATION_TOPIC_NAME), notification_string)diff --git a/zerver/actions/submessage.py b/zerver/actions/submessage.pyindex 3de331c936f..4cb88a1f0b2 100644--- a/zerver/actions/submessage.py+++ b/zerver/actions/submessage.py@@ -78,7 +78,7 @@ def do_add_submessage(do_set_user_topic_visibility_policy(user_profile=sender,stream=stream,- topic=submessage.message.topic_name(),+ topic_name=submessage.message.topic_name(),visibility_policy=new_visibility_policy,)diff --git a/zerver/actions/typing.py b/zerver/actions/typing.pyindex 79753d6847c..dbbd0826fa1 100644--- a/zerver/actions/typing.py+++ b/zerver/actions/typing.py@@ -66,7 +66,7 @@ def check_send_typing_notification(sender: UserProfile, user_ids: List[int], opedef do_send_stream_typing_notification(- sender: UserProfile, operator: str, stream: Stream, topic: str+ sender: UserProfile, operator: str, stream: Stream, topic_name: str) -> None:sender_dict = {"user_id": sender.id, "email": sender.email}@@ -76,7 +76,7 @@ def do_send_stream_typing_notification(op=operator,sender=sender_dict,stream_id=stream.id,- topic=topic,+ topic=topic_name,)# We don't notify long_term_idle subscribers.diff --git a/zerver/actions/user_topics.py b/zerver/actions/user_topics.pyindex 505a1859054..b4a290c4549 100644--- a/zerver/actions/user_topics.py+++ b/zerver/actions/user_topics.py@@ -15,7 +15,7 @@ from zerver.tornado.django_api import send_eventdef bulk_do_set_user_topic_visibility_policy(user_profiles: List[UserProfile],stream: Stream,- topic: str,+ topic_name: str,*,visibility_policy: int,last_updated: Optional[datetime] = None,@@ -27,7 +27,7 @@ def bulk_do_set_user_topic_visibility_policy(user_profiles_with_changed_user_topic_rows = bulk_set_user_topic_visibility_policy_in_database(user_profiles,stream.id,- topic,+ topic_name,visibility_policy=visibility_policy,recipient_id=stream.recipient_id,last_updated=last_updated,@@ -52,7 +52,7 @@ def bulk_do_set_user_topic_visibility_policy(user_topic_event: Dict[str, Any] = {"type": "user_topic","stream_id": stream.id,- "topic_name": topic,+ "topic_name": topic_name,"last_updated": datetime_to_timestamp(last_updated),"visibility_policy": visibility_policy,}@@ -63,7 +63,7 @@ def bulk_do_set_user_topic_visibility_policy(def do_set_user_topic_visibility_policy(user_profile: UserProfile,stream: Stream,- topic: str,+ topic_name: str,*,visibility_policy: int,last_updated: Optional[datetime] = None,@@ -75,7 +75,7 @@ def do_set_user_topic_visibility_policy(bulk_do_set_user_topic_visibility_policy([user_profile],stream,- topic,+ topic_name,visibility_policy=visibility_policy,last_updated=last_updated,skip_muted_topics_event=skip_muted_topics_event,diff --git a/zerver/lib/addressee.py b/zerver/lib/addressee.pyindex 24fff0cf9c3..8df8a4d5098 100644--- a/zerver/lib/addressee.py+++ b/zerver/lib/addressee.py@@ -52,17 +52,17 @@ class Addressee:stream: Optional[Stream] = None,stream_name: Optional[str] = None,stream_id: Optional[int] = None,- topic: Optional[str] = None,+ topic_name: Optional[str] = None,) -> None:assert msg_type in ["stream", "private"]- if msg_type == "stream" and topic is None:+ if msg_type == "stream" and topic_name is None:raise JsonableError(_("Missing topic"))self._msg_type = msg_typeself._user_profiles = user_profilesself._stream = streamself._stream_name = stream_nameself._stream_id = stream_id- self._topic = topic+ self._topic_name = topic_namedef is_stream(self) -> bool:return self._msg_type == "stream"@@ -87,10 +87,10 @@ class Addressee:assert self.is_stream()return self._stream_id- def topic(self) -> str:+ def topic_name(self) -> str:assert self.is_stream()- assert self._topic is not None- return self._topic+ assert self._topic_name is not None+ return self._topic_name@staticmethoddef legacy_build(@@ -143,33 +143,33 @@ class Addressee:raise JsonableError(_("Invalid message type"))@staticmethod- def for_stream(stream: Stream, topic: str) -> "Addressee":- topic = topic.strip()- check_stream_topic(topic)+ def for_stream(stream: Stream, topic_name: str) -> "Addressee":+ topic_name = topic_name.strip()+ check_stream_topic(topic_name)return Addressee(msg_type="stream",stream=stream,- topic=topic,+ topic_name=topic_name,)@staticmethod- def for_stream_name(stream_name: str, topic: str) -> "Addressee":- topic = topic.strip()- check_stream_topic(topic)+ def for_stream_name(stream_name: str, topic_name: str) -> "Addressee":+ topic_name = topic_name.strip()+ check_stream_topic(topic_name)return Addressee(msg_type="stream",stream_name=stream_name,- topic=topic,+ topic_name=topic_name,)@staticmethod- def for_stream_id(stream_id: int, topic: str) -> "Addressee":- topic = topic.strip()- check_stream_topic(topic)+ def for_stream_id(stream_id: int, topic_name: str) -> "Addressee":+ topic_name = topic_name.strip()+ check_stream_topic(topic_name)return Addressee(msg_type="stream",stream_id=stream_id,- topic=topic,+ topic_name=topic_name,)@staticmethoddiff --git a/zerver/lib/test_classes.py b/zerver/lib/test_classes.pyindex 821139d612d..9548fef8b67 100644--- a/zerver/lib/test_classes.py+++ b/zerver/lib/test_classes.py@@ -1129,7 +1129,7 @@ Output:sender=sender,client=sending_client,stream_name=stream_name,- topic=topic_name,+ topic_name=topic_name,body=content,realm=recipient_realm,read_by_sender=read_by_sender,diff --git a/zerver/models/realms.py b/zerver/models/realms.pyindex f243e5dd8ec..fe7a2b41d29 100644--- a/zerver/models/realms.py+++ b/zerver/models/realms.py@@ -334,7 +334,7 @@ class Realm(models.Model): # type: ignore[django-manager-missing] # django-stubDEFAULT_NOTIFICATION_STREAM_NAME = "general"INITIAL_PRIVATE_STREAM_NAME = "core team"- STREAM_EVENTS_NOTIFICATION_TOPIC = gettext_lazy("stream events")+ STREAM_EVENTS_NOTIFICATION_TOPIC_NAME = gettext_lazy("stream events")notifications_stream = models.ForeignKey("Stream",related_name="+",diff --git a/zerver/tests/test_message_edit.py b/zerver/tests/test_message_edit.pyindex 4e1dddfe9f5..9fbc13ab1d9 100644--- a/zerver/tests/test_message_edit.py+++ b/zerver/tests/test_message_edit.py@@ -2113,7 +2113,7 @@ class EditMessageTest(EditMessageTestCase):do_set_user_topic_visibility_policy(user_profile=hamlet,stream=get_stream(stream_name, cordelia.realm),- topic="test",+ topic_name="test",visibility_policy=UserTopic.VisibilityPolicy.FOLLOWED,)message_id = self.send_stream_message(hamlet, stream_name, "Hello everyone")@@ -2171,7 +2171,7 @@ class EditMessageTest(EditMessageTestCase):do_set_user_topic_visibility_policy(user_profile=hamlet,stream=get_stream(stream_name, cordelia.realm),- topic="test",+ topic_name="test",visibility_policy=UserTopic.VisibilityPolicy.FOLLOWED,)message_id = self.send_stream_message(hamlet, stream_name, "Hello everyone")diff --git a/zerver/tests/test_message_edit_notifications.py b/zerver/tests/test_message_edit_notifications.pyindex 69daf9dc5df..73026e0baba 100644--- a/zerver/tests/test_message_edit_notifications.py+++ b/zerver/tests/test_message_edit_notifications.py@@ -415,7 +415,7 @@ class EditMessageSideEffectsTest(ZulipTestCase):do_set_user_topic_visibility_policy(user_profile=cordelia,stream=get_stream("Scotland", cordelia.realm),- topic="test",+ topic_name="test",visibility_policy=UserTopic.VisibilityPolicy.FOLLOWED,)@@ -465,7 +465,7 @@ class EditMessageSideEffectsTest(ZulipTestCase):do_set_user_topic_visibility_policy(user_profile=cordelia,stream=get_stream("Scotland", cordelia.realm),- topic="test",+ topic_name="test",visibility_policy=UserTopic.VisibilityPolicy.FOLLOWED,)diff --git a/zerver/tests/test_message_send.py b/zerver/tests/test_message_send.pyindex 7df5eb5ff91..393d367173c 100644--- a/zerver/tests/test_message_send.py+++ b/zerver/tests/test_message_send.py@@ -1588,7 +1588,7 @@ class StreamMessagesTest(ZulipTestCase):sender=sender,client=sending_client,stream_name=stream_name,- topic=topic_name,+ topic_name=topic_name,body=content,)@@ -1608,7 +1608,7 @@ class StreamMessagesTest(ZulipTestCase):sender=sender,client=sending_client,stream_name=stream_name,- topic="new topic",+ topic_name="new topic",body=content,)@@ -1628,7 +1628,7 @@ class StreamMessagesTest(ZulipTestCase):sender=sender,client=sending_client,stream_name=stream_name,- topic="topic 2",+ topic_name="topic 2",body=content,)# If the topic is already FOLLOWED, there will be an increase in the query@@ -1639,7 +1639,7 @@ class StreamMessagesTest(ZulipTestCase):sender=sender,client=sending_client,stream_name=stream_name,- topic="topic 2",+ topic_name="topic 2",body=content,)@@ -1664,7 +1664,7 @@ class StreamMessagesTest(ZulipTestCase):sender=sender,client=sending_client,stream_name=stream_name,- topic="topic 2",+ topic_name="topic 2",body="@**" + user.full_name + "**",)# If the topic is already FOLLOWED, there will be an increase in the query@@ -1677,7 +1677,7 @@ class StreamMessagesTest(ZulipTestCase):sender=sender,client=sending_client,stream_name=stream_name,- topic="topic 2",+ topic_name="topic 2",body="@**" + user.full_name + "**",)@@ -1687,7 +1687,7 @@ class StreamMessagesTest(ZulipTestCase):sender=sender,client=sending_client,stream_name=stream_name,- topic="topic 2",+ topic_name="topic 2",body="@**all**",)@@ -2537,7 +2537,7 @@ class InternalPrepTest(ZulipTestCase):with self.assertLogs(level="ERROR") as m:internal_send_stream_message(sender=cordelia,- topic="whatever",+ topic_name="whatever",content=bad_content,stream=stream,)@@ -2554,7 +2554,7 @@ class InternalPrepTest(ZulipTestCase):realm=realm,sender=cordelia,stream_name=stream.name,- topic="whatever",+ topic_name="whatever",content=bad_content,)@@ -2598,11 +2598,15 @@ class InternalPrepTest(ZulipTestCase):realm = get_realm("zulip")sender = self.example_user("cordelia")stream_name = "test_stream"- topic = "whatever"+ topic_name = "whatever"content = "hello"internal_prep_stream_message_by_name(- realm=realm, sender=sender, stream_name=stream_name, topic=topic, content=content+ realm=realm,+ sender=sender,+ stream_name=stream_name,+ topic_name=topic_name,+ content=content,)# This would throw an error if the streamdiff --git a/zerver/views/streams.py b/zerver/views/streams.pyindex 64611e4ffb0..f3a1d3c66df 100644--- a/zerver/views/streams.py+++ b/zerver/views/streams.py@@ -773,7 +773,7 @@ def send_messages_for_new_subscribers(content = _("{user_name} created the following streams: {stream_str}.")else:content = _("{user_name} created a new stream {stream_str}.")- topic = _("new streams")+ topic_name = _("new streams")content = content.format(user_name=silent_mention_syntax_for_user(user_profile),@@ -786,7 +786,7 @@ def send_messages_for_new_subscribers(internal_prep_stream_message(sender=sender,stream=notifications_stream,- topic=topic,+ topic_name=topic_name,content=content,),)@@ -803,7 +803,7 @@ def send_messages_for_new_subscribers(internal_prep_stream_message(sender=sender,stream=stream,- topic=str(Realm.STREAM_EVENTS_NOTIFICATION_TOPIC),+ topic_name=str(Realm.STREAM_EVENTS_NOTIFICATION_TOPIC_NAME),content=_("**{policy}** stream created by {user_name}. **Description:**").format(