Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
topics: Don't send topic moved message on case only rename.
Shubham Padiabbf9b0eb1782
diff --git a/zerver/actions/message_edit.py b/zerver/actions/message_edit.pyindex ff3575caf33..e87c3c274e5 100644--- a/zerver/actions/message_edit.py+++ b/zerver/actions/message_edit.py@@ -1279,7 +1279,7 @@ def do_update_message())- if message_edit_request.is_message_moved:+ if message_edit_request.is_nontrivial_move:# Notify users that the topic was moved.old_thread_notification_string = Noneif send_notification_to_old_thread:@@ -1478,6 +1478,7 @@ def build_message_edit_request()is_topic_edited = False+ is_topic_case_only_rename = Falsetopic_resolved = Falsetopic_unresolved = Falseold_topic_name = message.topic_name()@@ -1487,6 +1488,7 @@ def build_message_edit_request(is_topic_edited = Truepre_truncation_target_topic_name = topic_nametarget_topic_name = truncate_topic(topic_name)+ is_topic_case_only_rename = old_topic_name.lower() == target_topic_name.lower()resolved_prefix_len = len(RESOLVED_TOPIC_PREFIX)topic_resolved = (@@ -1528,6 +1530,8 @@ def build_message_edit_request(is_topic_edited=is_topic_edited,target_topic_name=target_topic_name,is_stream_edited=is_stream_edited,+ is_nontrivial_move=is_stream_edited+ or (is_topic_edited and not is_topic_case_only_rename),topic_resolved=topic_resolved,topic_unresolved=topic_unresolved,orig_content=message.content,diff --git a/zerver/lib/types.py b/zerver/lib/types.pyindex 1aaddad0972..b30a795f989 100644--- a/zerver/lib/types.py+++ b/zerver/lib/types.py@@ -429,6 +429,7 @@ class StreamMessageEditRequest:is_topic_edited: boolis_stream_edited: boolis_message_moved: bool+ is_nontrivial_move: booltopic_resolved: booltopic_unresolved: boolcontent: strdiff --git a/zerver/tests/test_message_move_topic.py b/zerver/tests/test_message_move_topic.pyindex 8a86939fa35..ab79524cfdd 100644--- a/zerver/tests/test_message_move_topic.py+++ b/zerver/tests/test_message_move_topic.py@@ -2143,6 +2143,34 @@ class MessageMoveTopicTest(ZulipTestCase):self.assertEqual(read_user_ids, {hamlet.id})self.assertEqual(unread_user_ids, {cordelia.id, admin_user.id})+ def test_case_only_topic_rename_does_not_is_nontrivial_move(self) -> None:+ admin_user = self.example_user("iago")+ hamlet = self.example_user("hamlet")+ stream = self.make_stream("stream", hamlet.realm)++ self.subscribe(admin_user, stream.name)+ self.subscribe(hamlet, stream.name)++ old_topic_name = "old topic"+ new_topic_name = "Old Topic"+ message_id = self.send_stream_message(hamlet, stream.name, topic_name=old_topic_name)++ result = self.api_patch(+ hamlet,+ "/api/v1/messages/" + str(message_id),+ {+ "topic": new_topic_name,+ "send_notification_to_old_thread": "true",+ "send_notification_to_new_thread": "true",+ },+ )+ self.assert_json_success(result)++ messages_in_topic = get_topic_messages(admin_user, stream, new_topic_name)+ self.assert_length(messages_in_topic, 1)+ self.assertEqual(messages_in_topic[0].id, message_id)+ self.assertEqual(messages_in_topic[0].content, "test content")+@override_settings(RESOLVE_TOPIC_UNDO_GRACE_PERIOD_SECONDS=60)def test_mark_topic_as_resolved_within_grace_period(self) -> None:self.login("iago")