From eb9a142a9e4412493c8c3f175b09b7d965bc5ab8 Mon Sep 17 00:00:00 2001 From: Lauryn Menard Date: Wed, 17 Apr 2024 18:05:37 +0200 Subject: [PATCH] stream-events: Update topic name for stream to channel rename. In zerver/models/realms.py, updates the topic for stream/channel updates to be "channel events" instead of "stream events". Part of stream to channel rename project. --- tools/lib/capitalization.py | 2 +- zerver/models/realms.py | 2 +- zerver/tests/test_events.py | 2 +- zerver/tests/test_subs.py | 34 +++++++++++++++++----------------- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/tools/lib/capitalization.py b/tools/lib/capitalization.py index cb6f403f19..351420cb4e 100644 --- a/tools/lib/capitalization.py +++ b/tools/lib/capitalization.py @@ -103,7 +103,7 @@ IGNORED_PHRASES = [ r"in 3 hours", # these are used as topics r"^new channels$", - r"^stream events$", + r"^channel events$", # These are used as example short names (e.g. an uncapitalized context): r"^marketing$", r"^cookie$", diff --git a/zerver/models/realms.py b/zerver/models/realms.py index 9af0ec4bd7..aa1e12f034 100644 --- a/zerver/models/realms.py +++ b/zerver/models/realms.py @@ -335,7 +335,7 @@ class Realm(models.Model): # type: ignore[django-manager-missing] # django-stub DEFAULT_NOTIFICATION_STREAM_NAME = "general" INITIAL_PRIVATE_STREAM_NAME = "core team" - STREAM_EVENTS_NOTIFICATION_TOPIC_NAME = gettext_lazy("stream events") + STREAM_EVENTS_NOTIFICATION_TOPIC_NAME = gettext_lazy("channel events") new_stream_announcements_stream = models.ForeignKey( "Stream", related_name="+", diff --git a/zerver/tests/test_events.py b/zerver/tests/test_events.py index 3e8c944e91..eb9aa57e4e 100644 --- a/zerver/tests/test_events.py +++ b/zerver/tests/test_events.py @@ -3171,7 +3171,7 @@ class NormalActionsTest(BaseAction): client="Internal", ) - fields[TOPIC_NAME] = "stream events" + fields[TOPIC_NAME] = "channel events" msg = events[1]["message"] for k, v in fields.items(): diff --git a/zerver/tests/test_subs.py b/zerver/tests/test_subs.py index ebb1ba7847..ed169e4893 100644 --- a/zerver/tests/test_subs.py +++ b/zerver/tests/test_subs.py @@ -671,7 +671,7 @@ class StreamAdminTest(ZulipTestCase): self.assertFalse(stream.invite_only) self.assertTrue(stream.history_public_to_subscribers) - messages = get_topic_messages(user_profile, stream, "stream events") + messages = get_topic_messages(user_profile, stream, "channel events") self.assert_length(messages, 1) expected_notification = ( f"@_**King Hamlet|{user_profile.id}** changed the [access permissions](/help/stream-permissions) " @@ -732,7 +732,7 @@ class StreamAdminTest(ZulipTestCase): self.assertTrue(stream.invite_only) self.assertFalse(stream.history_public_to_subscribers) - messages = get_topic_messages(user_profile, stream, "stream events") + messages = get_topic_messages(user_profile, stream, "channel events") self.assert_length(messages, 1) expected_notification = ( f"@_**King Hamlet|{user_profile.id}** changed the [access permissions](/help/stream-permissions) " @@ -849,7 +849,7 @@ class StreamAdminTest(ZulipTestCase): self.assertFalse(stream.invite_only) self.assertFalse(stream.history_public_to_subscribers) - messages = get_topic_messages(user_profile, stream, "stream events") + messages = get_topic_messages(user_profile, stream, "channel events") self.assert_length(messages, 1) expected_notification = ( f"@_**{user_profile.full_name}|{user_profile.id}** changed the [access permissions](/help/stream-permissions) " @@ -888,7 +888,7 @@ class StreamAdminTest(ZulipTestCase): self.assertTrue(stream.invite_only) self.assertTrue(stream.history_public_to_subscribers) - messages = get_topic_messages(user_profile, stream, "stream events") + messages = get_topic_messages(user_profile, stream, "channel events") self.assert_length(messages, 1) expected_notification = ( f"@_**King Hamlet|{user_profile.id}** changed the [access permissions](/help/stream-permissions) " @@ -927,7 +927,7 @@ class StreamAdminTest(ZulipTestCase): self.assertTrue(stream.invite_only) self.assertTrue(stream.history_public_to_subscribers) - messages = get_topic_messages(user_profile, stream, "stream events") + messages = get_topic_messages(user_profile, stream, "channel events") self.assert_length(messages, 1) expected_notification = ( f"@_**King Hamlet|{user_profile.id}** changed the [access permissions](/help/stream-permissions) " @@ -1010,7 +1010,7 @@ class StreamAdminTest(ZulipTestCase): self.assertFalse(stream.invite_only) self.assertTrue(stream.history_public_to_subscribers) - messages = get_topic_messages(user_profile, stream, "stream events") + messages = get_topic_messages(user_profile, stream, "channel events") self.assert_length(messages, 1) expected_notification = ( f"@_**King Hamlet|{user_profile.id}** changed the [access permissions](/help/stream-permissions) " @@ -1047,7 +1047,7 @@ class StreamAdminTest(ZulipTestCase): self.assertTrue(stream.invite_only) self.assertTrue(stream.history_public_to_subscribers) - messages = get_topic_messages(user_profile, stream, "stream events") + messages = get_topic_messages(user_profile, stream, "channel events") self.assert_length(messages, 1) expected_notification = ( f"@_**Iago|{user_profile.id}** changed the [access permissions](/help/stream-permissions) " @@ -1077,7 +1077,7 @@ class StreamAdminTest(ZulipTestCase): self.assertTrue(stream.invite_only) self.assertFalse(stream.history_public_to_subscribers) - messages = get_topic_messages(user_profile, stream, "stream events") + messages = get_topic_messages(user_profile, stream, "channel events") self.assert_length(messages, 2) expected_notification = ( f"@_**Iago|{user_profile.id}** changed the [access permissions](/help/stream-permissions) " @@ -1871,7 +1871,7 @@ class StreamAdminTest(ZulipTestCase): stream = get_stream("stream_name1", realm) self.assertEqual(stream.description, "") - messages = get_topic_messages(user_profile, stream, "stream events") + messages = get_topic_messages(user_profile, stream, "channel events") expected_notification = ( f"@_**{user_profile.full_name}|{user_profile.id}** changed the description for this channel.\n\n" "* **Old description:**\n" @@ -1893,7 +1893,7 @@ class StreamAdminTest(ZulipTestCase): stream = get_stream("stream_name1", realm) self.assertEqual(stream.description, "Test description") - messages = get_topic_messages(user_profile, stream, "stream events") + messages = get_topic_messages(user_profile, stream, "channel events") expected_notification = ( f"@_**{user_profile.full_name}|{user_profile.id}** changed the description for this channel.\n\n" "* **Old description:**\n" @@ -1915,7 +1915,7 @@ class StreamAdminTest(ZulipTestCase): stream = get_stream("stream_name1", realm) self.assertEqual(stream.description, "a multi line description") - messages = get_topic_messages(user_profile, stream, "stream events") + messages = get_topic_messages(user_profile, stream, "channel events") expected_notification = ( f"@_**{user_profile.full_name}|{user_profile.id}** changed the description for this channel.\n\n" "* **Old description:**\n" @@ -1982,7 +1982,7 @@ class StreamAdminTest(ZulipTestCase): stream = get_stream("stream_name1", user_profile.realm) self.assertEqual(stream.stream_post_policy, Stream.STREAM_POST_POLICY_ADMINS) - messages = get_topic_messages(user_profile, stream, "stream events") + messages = get_topic_messages(user_profile, stream, "channel events") expected_notification = ( f"@_**{user_profile.full_name}|{user_profile.id}** changed the " "[posting permissions](/help/stream-sending-policy) for this channel:\n\n" @@ -2045,7 +2045,7 @@ class StreamAdminTest(ZulipTestCase): stream = get_stream("stream_name1", user_profile.realm) self.assertEqual(stream.stream_post_policy, policy) - messages = get_topic_messages(user_profile, stream, "stream events") + messages = get_topic_messages(user_profile, stream, "channel events") expected_notification = ( f"@_**{user_profile.full_name}|{user_profile.id}** changed the " "[posting permissions](/help/stream-sending-policy) for this channel:\n\n" @@ -2079,7 +2079,7 @@ class StreamAdminTest(ZulipTestCase): f"/json/streams/{stream.id}", {"message_retention_days": orjson.dumps(2).decode()} ) self.assert_json_success(result) - messages = get_topic_messages(user_profile, stream, "stream events") + messages = get_topic_messages(user_profile, stream, "channel events") self.assert_length(messages, 1) expected_notification = ( f"@_**Desdemona|{user_profile.id}** has changed the [message retention period](/help/message-retention-policy) for this channel:\n" @@ -2100,7 +2100,7 @@ class StreamAdminTest(ZulipTestCase): f"/json/streams/{stream.id}", {"message_retention_days": orjson.dumps(8).decode()} ) self.assert_json_success(result) - messages = get_topic_messages(user_profile, stream, "stream events") + messages = get_topic_messages(user_profile, stream, "channel events") self.assert_length(messages, 2) expected_notification = ( f"@_**Desdemona|{user_profile.id}** has changed the [message retention period](/help/message-retention-policy) for this channel:\n" @@ -2122,7 +2122,7 @@ class StreamAdminTest(ZulipTestCase): {"message_retention_days": orjson.dumps("realm_default").decode()}, ) self.assert_json_success(result) - messages = get_topic_messages(user_profile, stream, "stream events") + messages = get_topic_messages(user_profile, stream, "channel events") self.assert_length(messages, 3) expected_notification = ( f"@_**Desdemona|{user_profile.id}** has changed the [message retention period](/help/message-retention-policy) for this channel:\n" @@ -4634,7 +4634,7 @@ class SubscriptionAPITest(ZulipTestCase): # verify that a welcome message was sent to the stream msg = self.get_last_message() self.assertEqual(msg.recipient.type, msg.recipient.STREAM) - self.assertEqual(msg.topic_name(), "stream events") + self.assertEqual(msg.topic_name(), "channel events") self.assertEqual(msg.sender.email, settings.NOTIFICATION_BOT) self.assertIn( f"**{policy_name}** channel created by @_**{self.test_user.full_name}|{self.test_user.id}**. **Description:**\n"