diff --git a/zerver/actions/message_edit.py b/zerver/actions/message_edit.py index 77f82c2849..95d290faae 100644 --- a/zerver/actions/message_edit.py +++ b/zerver/actions/message_edit.py @@ -1039,20 +1039,12 @@ def do_update_message( resolved_topic_message_id = None resolved_topic_message_deleted = False - if topic_name is not None and content is None: - # When stream is changed and topic is marked as resolved or unresolved - # in the same API request, resolved or unresolved notification should - # be sent to "new_stream". - # In general, it is sent to "stream_being_edited". - stream_to_send_resolve_topic_notification = stream_being_edited - if new_stream is not None: - stream_to_send_resolve_topic_notification = new_stream - - assert stream_to_send_resolve_topic_notification is not None + if topic_name is not None and content is None and new_stream is None: + assert stream_being_edited is not None resolved_topic_message_id, resolved_topic_message_deleted = ( maybe_send_resolve_topic_notifications( user_profile=user_profile, - stream=stream_to_send_resolve_topic_notification, + stream=stream_being_edited, old_topic_name=orig_topic_name, new_topic_name=topic_name, changed_messages=changed_messages, diff --git a/zerver/tests/test_message_move_stream.py b/zerver/tests/test_message_move_stream.py index b8a0ca5cae..eefa5e1971 100644 --- a/zerver/tests/test_message_move_stream.py +++ b/zerver/tests/test_message_move_stream.py @@ -1441,13 +1441,9 @@ class MessageMoveStreamTest(ZulipTestCase): ) self.assert_json_success(result) messages = get_topic_messages(user_profile, new_stream, new_topic_name) - self.assert_length(messages, 5) + self.assert_length(messages, 4) self.assertEqual( messages[3].content, - f"@_**{user_profile.full_name}|{user_profile.id}** has marked this topic as resolved.", - ) - self.assertEqual( - messages[4].content, f"This topic was moved here from #**{first_stream.name}>test** by @_**{user_profile.full_name}|{user_profile.id}**.", ) @@ -1464,13 +1460,9 @@ class MessageMoveStreamTest(ZulipTestCase): ) self.assert_json_success(result) messages = get_topic_messages(user_profile, new_stream, new_topic_name) - self.assert_length(messages, 7) + self.assert_length(messages, 5) self.assertEqual( - messages[5].content, - f"@_**{user_profile.full_name}|{user_profile.id}** has marked this topic as unresolved.", - ) - self.assertEqual( - messages[6].content, + messages[4].content, f"This topic was moved here from #**{second_stream.name}>✔ test** by @_**{user_profile.full_name}|{user_profile.id}**.", )