Repository: zulip/zulip

Issue:
Show "Send notification to new/old topic" options for moves within stream
At present, when moving messages via the three-dot message menu, we only show the option to Send notification to new/old topic when messages are being moved to a new stream.

Instead, we should show these options for within-stream moves as well, as it can help avoid confusion about moved messages. Note that we already allow this when moving messages via the three-dot topic menu in the left sidebar.


Discussion:
Hello @zulip/server-message-view members, this issue was labeled with the "area: message-editing" label, so you may want to check it out!

<!-- areaLabelAddition -->

@zulipbot claim
Hello @mariosmantzaris, it looks like you've currently claimed 1 issue in this repository. We encourage new contributors to focus their efforts on at most 1 issue at a time, so please complete your work on your other claimed issues before trying to claim this issue again.

We look forward to your valuable contributions!

@zulipbot claim

@mariosmantzaris You have been unassigned from this issue because you have not made any updates for over 14 days. Please feel free to reclaim the issue if you decide to pick up again. Thanks!

@zulipbot claim

@mariosmantzaris We noticed that you have not made any updates to this issue or linked PRs for 10 days. Please comment here if you are still actively working on it. Otherwise, we'd appreciate a quick `@zulipbot abandon` comment so that someone else can claim this issue and continue from where you left off.

If we don't hear back, you will be automatically unassigned in 4 days. Thanks!

<!-- inactiveWarning -->

@zulipbot abandon

@juliaBichler01 would you be up for picking this one up, since you worked on #19196 recently?
@alya yes, i already started working on it.
I am not finished working on it yet, but i created a draft PR, so that you can have a look at it if you want to: [#22312](https://github.com/zulip/zulip/pull/22312)
Thanks! I'll review the PR once it's been approved by your code review buddies and is ready for me to take a look.

Resolving patch:
diff --git a/version.py b/version.py
--- a/version.py
+++ b/version.py
@@ -33,7 +33,7 @@
 # Changes should be accompanied by documentation explaining what the
 # new level means in templates/zerver/api/changelog.md, as well as
 # "**Changes**" entries in the endpoint's documentation in `zulip.yaml`.
-API_FEATURE_LEVEL = 151
+API_FEATURE_LEVEL = 152
 
 # Bump the minor PROVISION_VERSION to indicate that folks should provision
 # only when going from an old version of the code to a newer version. Bump
diff --git a/zerver/actions/message_edit.py b/zerver/actions/message_edit.py
--- a/zerver/actions/message_edit.py
+++ b/zerver/actions/message_edit.py
@@ -816,6 +816,7 @@ def user_info(um: UserMessage) -> Dict[str, Any]:
 
     send_event(user_profile.realm, event, users_to_be_notified)
 
+    sent_resolve_topic_notification = False
     if (
         topic_name is not None
         and new_stream is None
@@ -823,7 +824,7 @@ def user_info(um: UserMessage) -> Dict[str, Any]:
         and len(changed_messages) > 0
     ):
         assert stream_being_edited is not None
-        maybe_send_resolve_topic_notifications(
+        sent_resolve_topic_notification = maybe_send_resolve_topic_notifications(
             user_profile=user_profile,
             stream=stream_being_edited,
             old_topic=orig_topic_name,
@@ -831,7 +832,11 @@ def user_info(um: UserMessage) -> Dict[str, Any]:
             changed_messages=changed_messages,
         )
 
-    if len(changed_messages) > 0 and new_stream is not None and stream_being_edited is not None:
+    if (
+        len(changed_messages) > 0
+        and (new_stream is not None or topic_name is not None)
+        and stream_being_edited is not None
+    ):
         # Notify users that the topic was moved.
         changed_messages_count = len(changed_messages)
 
@@ -850,8 +855,25 @@ def user_info(um: UserMessage) -> Dict[str, Any]:
                     "{changed_messages_count} messages were moved from this topic to {new_location} by {user}."
                 )
 
+        # The new thread notification code path is a bit subtle. We
+        # don't want every resolve-topic action to also annoyingly
+        # send an extra notification that the topic was moved!
+        #
+        # Since one can resolve/unresolve a topic at the same time
+        # you're moving it, we need to carefully treat the resolve
+        # topic notification as satisfying our obligation to send a
+        # notification to the new topic only if the only thing this
+        # request did is mark the topic as resolved.
         new_thread_notification_string = None
-        if send_notification_to_new_thread:
+        if send_notification_to_new_thread and (
+            new_stream is not None
+            or not sent_resolve_topic_notification
+            or (
+                topic_name is not None
+                and orig_topic_name.lstrip(RESOLVED_TOPIC_PREFIX)
+                != topic_name.lstrip(RESOLVED_TOPIC_PREFIX)
+            )
+        ):
             if moved_all_visible_messages:
                 new_thread_notification_string = gettext_lazy(
                     "This topic was moved here from {old_location} by {user}."
@@ -870,7 +892,7 @@ def user_info(um: UserMessage) -> Dict[str, Any]:
             stream_being_edited,
             orig_topic_name,
             old_thread_notification_string,
-            new_stream,
+            new_stream if new_stream is not None else stream_being_edited,
             topic_name,
             new_thread_notification_string,
             changed_messages_count,
diff --git a/zerver/views/message_edit.py b/zerver/views/message_edit.py
--- a/zerver/views/message_edit.py
+++ b/zerver/views/message_edit.py
@@ -122,7 +122,7 @@ def update_message_backend(
     propagate_mode: str = REQ(
         default="change_one", str_validator=check_string_in(PROPAGATE_MODE_VALUES)
     ),
-    send_notification_to_old_thread: bool = REQ(default=True, json_validator=check_bool),
+    send_notification_to_old_thread: bool = REQ(default=False, json_validator=check_bool),
     send_notification_to_new_thread: bool = REQ(default=True, json_validator=check_bool),
     content: Optional[str] = REQ(default=None),
 ) -> HttpResponse:


Test patch:
diff --git a/frontend_tests/puppeteer_tests/edit.ts b/frontend_tests/puppeteer_tests/edit.ts
--- a/frontend_tests/puppeteer_tests/edit.ts
+++ b/frontend_tests/puppeteer_tests/edit.ts
@@ -37,9 +37,9 @@ async function test_stream_message_edit(page: Page): Promise<void> {
         content: "test editing",
     });
 
-    await edit_stream_message(page, "edited", "test edited");
+    await edit_stream_message(page, "edits", "test edited");
 
-    await common.check_messages_sent(page, "zhome", [["Verona > edited", ["test edited"]]]);
+    await common.check_messages_sent(page, "zhome", [["Verona > edits", ["test edited"]]]);
 }
 
 async function test_edit_message_with_slash_me(page: Page): Promise<void> {
@@ -61,7 +61,7 @@ async function test_edit_message_with_slash_me(page: Page): Promise<void> {
         )} and normalize-space()="Desdemona"]`,
     );
 
-    await edit_stream_message(page, "edited", "/me test edited a message with me");
+    await edit_stream_message(page, "edits", "/me test edited a message with me");
 
     await page.waitForSelector(
         `xpath/${last_message_xpath}//*[${common.has_class_x(
diff --git a/zerver/tests/test_message_edit.py b/zerver/tests/test_message_edit.py
--- a/zerver/tests/test_message_edit.py
+++ b/zerver/tests/test_message_edit.py
@@ -1305,9 +1305,9 @@ def notify(user_id: int) -> Dict[str, Any]:
                 send_notification_to_new_thread=False,
                 content=None,
             )
-            # This code path adds 9 (1 + 4/user with muted topics) to
+            # This code path adds 9 (1 + 4/user with muted topics) + 1 to
             # the number of database queries for moving a topic.
-            self.assert_length(queries, 18)
+            self.assert_length(queries, 19)
 
         for muting_user in get_users_muting_topic(stream.id, change_all_topic_name):
             for user in users_to_be_notified:
@@ -1755,6 +1755,7 @@ def test_move_message_to_stream(self) -> None:
             {
                 "stream_id": new_stream.id,
                 "propagate_mode": "change_all",
+                "send_notification_to_old_thread": "true",
             },
             HTTP_ACCEPT_LANGUAGE="de",
         )
@@ -1903,6 +1904,7 @@ def test_move_message_to_stream_change_later(self) -> None:
             {
                 "stream_id": new_stream.id,
                 "propagate_mode": "change_later",
+                "send_notification_to_old_thread": "true",
             },
         )
         self.assert_json_success(result)
@@ -1933,6 +1935,7 @@ def test_move_message_to_stream_change_later_all_moved(self) -> None:
             {
                 "stream_id": new_stream.id,
                 "propagate_mode": "change_later",
+                "send_notification_to_old_thread": "true",
             },
         )
         self.assert_json_success(result)
@@ -1962,6 +1965,7 @@ def test_move_message_to_stream_change_one(self) -> None:
             {
                 "stream_id": new_stream.id,
                 "propagate_mode": "change_one",
+                "send_notification_to_old_thread": "true",
             },
         )
         self.assert_json_success(result)
@@ -1992,6 +1996,7 @@ def test_move_message_to_stream_change_all(self) -> None:
             {
                 "stream_id": new_stream.id,
                 "propagate_mode": "change_all",
+                "send_notification_to_old_thread": "true",
             },
         )
         self.assert_json_success(result)
@@ -2036,7 +2041,7 @@ def check_move_message_according_to_policy(role: int, expect_fail: bool = False)
             else:
                 self.assert_json_success(result)
                 messages = get_topic_messages(user_profile, old_stream, "test")
-                self.assert_length(messages, 1)
+                self.assert_length(messages, 0)
                 messages = get_topic_messages(user_profile, new_stream, "test")
                 self.assert_length(messages, 4)
 
@@ -2125,7 +2130,7 @@ def check_move_message_to_stream(role: int, error_msg: Optional[str] = None) ->
             else:
                 self.assert_json_success(result)
                 messages = get_topic_messages(user_profile, old_stream, "test")
-                self.assert_length(messages, 1)
+                self.assert_length(messages, 0)
                 messages = get_topic_messages(user_profile, new_stream, "test")
                 self.assert_length(messages, 4)
 
@@ -2222,7 +2227,7 @@ def test_move_message_to_stream_with_topic_editing_not_allowed(self) -> None:
         )
         self.assert_json_success(result)
         messages = get_topic_messages(user_profile, old_stream, "test")
-        self.assert_length(messages, 1)
+        self.assert_length(messages, 0)
         messages = get_topic_messages(user_profile, new_stream, "test")
         self.assert_length(messages, 4)
 
@@ -2235,8 +2240,9 @@ def test_move_message_to_stream_and_topic(self) -> None:
             result = self.client_patch(
                 f"/json/messages/{msg_id}",
                 {
-                    "stream_id": new_stream.id,
                     "propagate_mode": "change_all",
+                    "send_notification_to_old_thread": "true",
+                    "stream_id": new_stream.id,
                     "topic": "new topic",
                 },
             )
@@ -2448,6 +2454,290 @@ def test_notify_old_thread_move_message_to_stream(self) -> None:
         messages = get_topic_messages(user_profile, new_stream, "test")
         self.assert_length(messages, 3)
 
+    def test_notify_new_topic(self) -> None:
+        user_profile = self.example_user("iago")
+        self.login("iago")
+        stream = self.make_stream("public stream")
+        self.subscribe(user_profile, stream.name)
+        msg_id = self.send_stream_message(
+            user_profile, stream.name, topic_name="test", content="First"
+        )
+        self.send_stream_message(user_profile, stream.name, topic_name="test", content="Second")
+        self.send_stream_message(user_profile, stream.name, topic_name="test", content="third")
+
+        result = self.client_patch(
+            "/json/messages/" + str(msg_id),
+            {
+                "message_id": msg_id,
+                "topic": "edited",
+                "propagate_mode": "change_all",
+                "send_notification_to_old_thread": "false",
+                "send_notification_to_new_thread": "true",
+            },
+        )
+
+        self.assert_json_success(result)
+
+        messages = get_topic_messages(user_profile, stream, "test")
+        self.assert_length(messages, 0)
+
+        messages = get_topic_messages(user_profile, stream, "edited")
+        self.assert_length(messages, 4)
+        self.assertEqual(
+            messages[3].content,
+            f"This topic was moved here from #**public stream>test** by @_**Iago|{user_profile.id}**.",
+        )
+
+    def test_notify_old_topic(self) -> None:
+        user_profile = self.example_user("iago")
+        self.login("iago")
+        stream = self.make_stream("public stream")
+        self.subscribe(user_profile, stream.name)
+        msg_id = self.send_stream_message(
+            user_profile, stream.name, topic_name="test", content="First"
+        )
+        self.send_stream_message(user_profile, stream.name, topic_name="test", content="Second")
+        self.send_stream_message(user_profile, stream.name, topic_name="test", content="third")
+
+        result = self.client_patch(
+            "/json/messages/" + str(msg_id),
+            {
+                "message_id": msg_id,
+                "topic": "edited",
+                "propagate_mode": "change_all",
+                "send_notification_to_old_thread": "true",
+                "send_notification_to_new_thread": "false",
+            },
+        )
+
+        self.assert_json_success(result)
+
+        messages = get_topic_messages(user_profile, stream, "test")
+        self.assert_length(messages, 1)
+        self.assertEqual(
+            messages[0].content,
+            f"This topic was moved to #**public stream>edited** by @_**Iago|{user_profile.id}**.",
+        )
+
+        messages = get_topic_messages(user_profile, stream, "edited")
+        self.assert_length(messages, 3)
+
+    def test_notify_both_topics(self) -> None:
+        user_profile = self.example_user("iago")
+        self.login("iago")
+        stream = self.make_stream("public stream")
+        self.subscribe(user_profile, stream.name)
+        msg_id = self.send_stream_message(
+            user_profile, stream.name, topic_name="test", content="First"
+        )
+        self.send_stream_message(user_profile, stream.name, topic_name="test", content="Second")
+        self.send_stream_message(user_profile, stream.name, topic_name="test", content="third")
+
+        result = self.client_patch(
+            "/json/messages/" + str(msg_id),
+            {
+                "message_id": msg_id,
+                "topic": "edited",
+                "propagate_mode": "change_all",
+                "send_notification_to_old_thread": "true",
+                "send_notification_to_new_thread": "true",
+            },
+        )
+
+        self.assert_json_success(result)
+
+        messages = get_topic_messages(user_profile, stream, "test")
+        self.assert_length(messages, 1)
+        self.assertEqual(
+            messages[0].content,
+            f"This topic was moved to #**public stream>edited** by @_**Iago|{user_profile.id}**.",
+        )
+
+        messages = get_topic_messages(user_profile, stream, "edited")
+        self.assert_length(messages, 4)
+        self.assertEqual(
+            messages[3].content,
+            f"This topic was moved here from #**public stream>test** by @_**Iago|{user_profile.id}**.",
+        )
+
+    def test_notify_no_topic(self) -> None:
+        user_profile = self.example_user("iago")
+        self.login("iago")
+        stream = self.make_stream("public stream")
+        self.subscribe(user_profile, stream.name)
+        msg_id = self.send_stream_message(
+            user_profile, stream.name, topic_name="test", content="First"
+        )
+        self.send_stream_message(user_profile, stream.name, topic_name="test", content="Second")
+        self.send_stream_message(user_profile, stream.name, topic_name="test", content="third")
+
+        result = self.client_patch(
+            "/json/messages/" + str(msg_id),
+            {
+                "message_id": msg_id,
+                "topic": "edited",
+                "propagate_mode": "change_all",
+                "send_notification_to_old_thread": "false",
+                "send_notification_to_new_thread": "false",
+            },
+        )
+
+        self.assert_json_success(result)
+
+        messages = get_topic_messages(user_profile, stream, "test")
+        self.assert_length(messages, 0)
+
+        messages = get_topic_messages(user_profile, stream, "edited")
+        self.assert_length(messages, 3)
+
+    def test_notify_new_topics_after_message_move(self) -> None:
+        user_profile = self.example_user("iago")
+        self.login("iago")
+        stream = self.make_stream("public stream")
+        self.subscribe(user_profile, stream.name)
+        msg_id = self.send_stream_message(
+            user_profile, stream.name, topic_name="test", content="First"
+        )
+        self.send_stream_message(user_profile, stream.name, topic_name="test", content="Second")
+        self.send_stream_message(user_profile, stream.name, topic_name="test", content="Third")
+
+        result = self.client_patch(
+            "/json/messages/" + str(msg_id),
+            {
+                "message_id": msg_id,
+                "topic": "edited",
+                "propagate_mode": "change_one",
+                "send_notification_to_old_thread": "false",
+                "send_notification_to_new_thread": "true",
+            },
+        )
+
+        self.assert_json_success(result)
+
+        messages = get_topic_messages(user_profile, stream, "test")
+        self.assert_length(messages, 2)
+        self.assertEqual(messages[0].content, "Second")
+        self.assertEqual(messages[1].content, "Third")
+
+        messages = get_topic_messages(user_profile, stream, "edited")
+        self.assert_length(messages, 2)
+        self.assertEqual(messages[0].content, "First")
+        self.assertEqual(
+            messages[1].content,
+            f"A message was moved here from #**public stream>test** by @_**Iago|{user_profile.id}**.",
+        )
+
+    def test_notify_old_topics_after_message_move(self) -> None:
+        user_profile = self.example_user("iago")
+        self.login("iago")
+        stream = self.make_stream("public stream")
+        self.subscribe(user_profile, stream.name)
+        msg_id = self.send_stream_message(
+            user_profile, stream.name, topic_name="test", content="First"
+        )
+        self.send_stream_message(user_profile, stream.name, topic_name="test", content="Second")
+        self.send_stream_message(user_profile, stream.name, topic_name="test", content="Third")
+
+        result = self.client_patch(
+            "/json/messages/" + str(msg_id),
+            {
+                "message_id": msg_id,
+                "topic": "edited",
+                "propagate_mode": "change_one",
+                "send_notification_to_old_thread": "true",
+                "send_notification_to_new_thread": "false",
+            },
+        )
+
+        self.assert_json_success(result)
+
+        messages = get_topic_messages(user_profile, stream, "test")
+        self.assert_length(messages, 3)
+        self.assertEqual(messages[0].content, "Second")
+        self.assertEqual(messages[1].content, "Third")
+        self.assertEqual(
+            messages[2].content,
+            f"A message was moved from this topic to #**public stream>edited** by @_**Iago|{user_profile.id}**.",
+        )
+
+        messages = get_topic_messages(user_profile, stream, "edited")
+        self.assert_length(messages, 1)
+        self.assertEqual(messages[0].content, "First")
+
+    def test_notify_both_topics_after_message_move(self) -> None:
+        user_profile = self.example_user("iago")
+        self.login("iago")
+        stream = self.make_stream("public stream")
+        self.subscribe(user_profile, stream.name)
+        msg_id = self.send_stream_message(
+            user_profile, stream.name, topic_name="test", content="First"
+        )
+        self.send_stream_message(user_profile, stream.name, topic_name="test", content="Second")
+        self.send_stream_message(user_profile, stream.name, topic_name="test", content="Third")
+
+        result = self.client_patch(
+            "/json/messages/" + str(msg_id),
+            {
+                "message_id": msg_id,
+                "topic": "edited",
+                "propagate_mode": "change_one",
+                "send_notification_to_old_thread": "true",
+                "send_notification_to_new_thread": "true",
+            },
+        )
+
+        self.assert_json_success(result)
+
+        messages = get_topic_messages(user_profile, stream, "test")
+        self.assert_length(messages, 3)
+        self.assertEqual(messages[0].content, "Second")
+        self.assertEqual(messages[1].content, "Third")
+        self.assertEqual(
+            messages[2].content,
+            f"A message was moved from this topic to #**public stream>edited** by @_**Iago|{user_profile.id}**.",
+        )
+
+        messages = get_topic_messages(user_profile, stream, "edited")
+        self.assert_length(messages, 2)
+        self.assertEqual(messages[0].content, "First")
+        self.assertEqual(
+            messages[1].content,
+            f"A message was moved here from #**public stream>test** by @_**Iago|{user_profile.id}**.",
+        )
+
+    def test_notify_no_topic_after_message_move(self) -> None:
+        user_profile = self.example_user("iago")
+        self.login("iago")
+        stream = self.make_stream("public stream")
+        self.subscribe(user_profile, stream.name)
+        msg_id = self.send_stream_message(
+            user_profile, stream.name, topic_name="test", content="First"
+        )
+        self.send_stream_message(user_profile, stream.name, topic_name="test", content="Second")
+        self.send_stream_message(user_profile, stream.name, topic_name="test", content="Third")
+
+        result = self.client_patch(
+            "/json/messages/" + str(msg_id),
+            {
+                "message_id": msg_id,
+                "topic": "edited",
+                "propagate_mode": "change_one",
+                "send_notification_to_old_thread": "false",
+                "send_notification_to_new_thread": "false",
+            },
+        )
+
+        self.assert_json_success(result)
+
+        messages = get_topic_messages(user_profile, stream, "test")
+        self.assert_length(messages, 2)
+        self.assertEqual(messages[0].content, "Second")
+        self.assertEqual(messages[1].content, "Third")
+
+        messages = get_topic_messages(user_profile, stream, "edited")
+        self.assert_length(messages, 1)
+        self.assertEqual(messages[0].content, "First")
+
     def parameterized_test_move_message_involving_private_stream(
         self,
         from_invite_only: bool,
@@ -2503,11 +2793,7 @@ def parameterized_test_move_message_involving_private_stream(
         self.assert_json_success(result)
 
         messages = get_topic_messages(admin_user, old_stream, "test")
-        self.assert_length(messages, 1)
-        self.assertEqual(
-            messages[0].content,
-            f"This topic was moved to #**new stream>test** by @_**Iago|{admin_user.id}**.",
-        )
+        self.assert_length(messages, 0)
 
         messages = get_topic_messages(admin_user, new_stream, "test")
         self.assert_length(messages, 3)
@@ -2649,7 +2935,7 @@ def test_mark_topic_as_resolved(self) -> None:
             == 0
         )
 
-        # Now move to a weird state and confirm no new messages
+        # Now move to a weird state and confirm we get the normal topic moved message.
         weird_topic = "✔ ✔✔" + original_topic
         result = self.client_patch(
             "/json/messages/" + str(id1),
@@ -2668,11 +2954,15 @@ def test_mark_topic_as_resolved(self) -> None:
             )
 
         messages = get_topic_messages(admin_user, stream, weird_topic)
-        self.assert_length(messages, 3)
+        self.assert_length(messages, 4)
         self.assertEqual(
             messages[2].content,
             f"@_**Iago|{admin_user.id}** has marked this topic as resolved.",
         )
+        self.assertEqual(
+            messages[3].content,
+            f"This topic was moved here from #**new>✔ topic 1** by @_**Iago|{admin_user.id}**.",
+        )
 
         unresolved_topic = original_topic
         result = self.client_patch(
@@ -2692,16 +2982,19 @@ def test_mark_topic_as_resolved(self) -> None:
             )
 
         messages = get_topic_messages(admin_user, stream, unresolved_topic)
-        self.assert_length(messages, 4)
+        self.assert_length(messages, 5)
         self.assertEqual(
-            messages[3].content,
+            messages[2].content, f"@_**Iago|{admin_user.id}** has marked this topic as resolved."
+        )
+        self.assertEqual(
+            messages[4].content,
             f"@_**Iago|{admin_user.id}** has marked this topic as unresolved.",
         )
 
         # Check topic unresolved notification message is only unread for participants.
         assert (
             UserMessage.objects.filter(
-                user_profile__in=[admin_user, hamlet, aaron], message__id=messages[3].id
+                user_profile__in=[admin_user, hamlet, aaron], message__id=messages[4].id
             )
             .extra(where=[UserMessage.where_unread()])
             .count()
@@ -2709,12 +3002,42 @@ def test_mark_topic_as_resolved(self) -> None:
         )
 
         assert (
-            UserMessage.objects.filter(user_profile=cordelia, message__id=messages[3].id)
+            UserMessage.objects.filter(user_profile=cordelia, message__id=messages[4].id)
             .extra(where=[UserMessage.where_unread()])
             .count()
             == 0
         )
 
+        # Now move to another stream while resolving the topic and
+        # check the notifications.
+        final_stream = self.make_stream("final")
+        self.subscribe(admin_user, final_stream.name)
+        result = self.client_patch(
+            "/json/messages/" + str(id1),
+            {
+                "topic": resolved_topic,
+                "stream_id": final_stream.id,
+                "propagate_mode": "change_all",
+            },
+        )
+        self.assert_json_success(result)
+        for msg_id in [id1, id2]:
+            msg = Message.objects.get(id=msg_id)
+            self.assertEqual(
+                resolved_topic,
+                msg.topic_name(),
+            )
+
+        messages = get_topic_messages(admin_user, final_stream, resolved_topic)
+        # TODO: This should be 7 -- but currently we never trigger
+        # resolve-topic notifications when moving the stream, even if
+        # the resolve-topic state is changed at that time.
+        self.assert_length(messages, 6)
+        self.assertEqual(
+            messages[5].content,
+            f"This topic was moved here from #**new>topic 1** by @_**Iago|{admin_user.id}**.",
+        )
+
 
 class DeleteMessageTest(ZulipTestCase):
     def test_delete_message_invalid_request_format(self) -> None: