Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
i18n: Update translated errors for stream to channel rename.
Lauryn Menard9be4d0744234
diff --git a/zerver/actions/default_streams.py b/zerver/actions/default_streams.pyindex 015adc2e753..da999cf3e40 100644--- a/zerver/actions/default_streams.py+++ b/zerver/actions/default_streams.py@@ -17,11 +17,11 @@ from zerver.tornado.django_api import send_event_on_commitdef check_default_stream_group_name(group_name: str) -> None:if group_name.strip() == "":raise JsonableError(- _("Invalid default stream group name '{group_name}'").format(group_name=group_name)+ _("Invalid default channel group name '{group_name}'").format(group_name=group_name))if len(group_name) > DefaultStreamGroup.MAX_NAME_LENGTH:raise JsonableError(- _("Default stream group name too long (limit: {max_length} characters)").format(+ _("Default channel group name too long (limit: {max_length} characters)").format(max_length=DefaultStreamGroup.MAX_NAME_LENGTH,))@@ -29,7 +29,7 @@ def check_default_stream_group_name(group_name: str) -> None:if ord(i) == 0:raise JsonableError(_(- "Default stream group name '{group_name}' contains NULL (0x00) characters."+ "Default channel group name '{group_name}' contains NULL (0x00) characters.").format(group_name=group_name,)@@ -45,7 +45,7 @@ def lookup_default_stream_groups(default_stream_group = DefaultStreamGroup.objects.get(name=group_name, realm=realm)except DefaultStreamGroup.DoesNotExist:raise JsonableError(- _("Invalid default stream group {group_name}").format(group_name=group_name)+ _("Invalid default channel group {group_name}").format(group_name=group_name))default_stream_groups.append(default_stream_group)return default_stream_groups@@ -93,7 +93,7 @@ def do_create_default_stream_group(if stream.id in default_stream_ids:raise JsonableError(_(- "'{channel_name}' is a default stream and cannot be added to '{group_name}'",+ "'{channel_name}' is a default channel and cannot be added to '{group_name}'",).format(channel_name=stream.name, group_name=group_name))@@ -104,7 +104,7 @@ def do_create_default_stream_group(if not created:raise JsonableError(_(- "Default stream group '{group_name}' already exists",+ "Default channel group '{group_name}' already exists",).format(group_name=group_name))@@ -120,13 +120,13 @@ def do_add_streams_to_default_stream_group(if stream.id in default_stream_ids:raise JsonableError(_(- "'{channel_name}' is a default stream and cannot be added to '{group_name}'",+ "'{channel_name}' is a default channel and cannot be added to '{group_name}'",).format(channel_name=stream.name, group_name=group.name))if stream in group.streams.all():raise JsonableError(_(- "Stream '{channel_name}' is already present in default stream group '{group_name}'",+ "Channel '{channel_name}' is already present in default channel group '{group_name}'",).format(channel_name=stream.name, group_name=group.name))group.streams.add(stream)@@ -143,7 +143,7 @@ def do_remove_streams_from_default_stream_group(if stream.id not in group_stream_ids:raise JsonableError(_(- "Stream '{channel_name}' is not present in default stream group '{group_name}'",+ "Channel '{channel_name}' is not present in default channel group '{group_name}'",).format(channel_name=stream.name, group_name=group.name))@@ -158,14 +158,14 @@ def do_change_default_stream_group_name() -> None:if group.name == new_group_name:raise JsonableError(- _("This default stream group is already named '{group_name}'").format(+ _("This default channel group is already named '{group_name}'").format(group_name=new_group_name))if DefaultStreamGroup.objects.filter(name=new_group_name, realm=realm).exists():raise JsonableError(- _("Default stream group '{group_name}' already exists").format(+ _("Default channel group '{group_name}' already exists").format(group_name=new_group_name))diff --git a/zerver/actions/message_edit.py b/zerver/actions/message_edit.pyindex 93a01a7832c..c2788d8d498 100644--- a/zerver/actions/message_edit.py+++ b/zerver/actions/message_edit.py@@ -103,7 +103,7 @@ def validate_message_edit_payload(if not message.is_stream_message():if stream_id is not None:- raise JsonableError(_("Direct messages cannot be moved to streams."))+ raise JsonableError(_("Direct messages cannot be moved to channels."))if topic_name is not None:raise JsonableError(_("Direct messages cannot have topics."))@@ -114,7 +114,7 @@ def validate_message_edit_payload(check_stream_topic(topic_name)if stream_id is not None and content is not None:- raise JsonableError(_("Cannot change message content while changing stream"))+ raise JsonableError(_("Cannot change message content while changing channel"))# Right now, we prevent users from editing widgets.if content is not None and is_widget_message(message):@@ -1325,7 +1325,7 @@ def check_update_message()if (timezone_now() - message.date_sent) > timedelta(seconds=deadline_seconds):raise JsonableError(- _("The time limit for editing this message's stream has passed")+ _("The time limit for editing this message's channel has passed"))if (diff --git a/zerver/lib/addressee.py b/zerver/lib/addressee.pyindex ccffd7207eb..2a1ac0eeb45 100644--- a/zerver/lib/addressee.py+++ b/zerver/lib/addressee.py@@ -108,7 +108,7 @@ class Addressee:if recipient_type_name == "stream":if len(message_to) > 1:- raise JsonableError(_("Cannot send to multiple streams"))+ raise JsonableError(_("Cannot send to multiple channels"))if message_to:stream_name_or_id = message_to[0]@@ -120,7 +120,7 @@ class Addressee:# Use the user's default streamstream_name_or_id = sender.default_sending_stream_idelse:- raise JsonableError(_("Missing stream"))+ raise JsonableError(_("Missing channel"))if topic_name is None:raise JsonableError(_("Missing topic"))diff --git a/zerver/lib/drafts.py b/zerver/lib/drafts.pyindex be34f7be856..eca1b2110bc 100644--- a/zerver/lib/drafts.py+++ b/zerver/lib/drafts.py@@ -60,7 +60,7 @@ def further_validated_draft_dict(if "\0" in topic_name:raise JsonableError(_("Topic must not contain null bytes"))if len(to) != 1:- raise JsonableError(_("Must specify exactly 1 stream ID for stream messages"))+ raise JsonableError(_("Must specify exactly 1 channel ID for channel messages"))stream, sub = access_stream_by_id(user_profile, to[0])recipient_id = stream.recipient_idelif draft_dict.type == "private" and len(to) != 0:diff --git a/zerver/lib/recipient_parsing.py b/zerver/lib/recipient_parsing.pyindex 78fd6b17f43..2386cdb4fdc 100644--- a/zerver/lib/recipient_parsing.py+++ b/zerver/lib/recipient_parsing.py@@ -11,7 +11,7 @@ def extract_stream_id(req_to: str) -> int:try:stream_id = int(req_to)except ValueError:- raise JsonableError(_("Invalid data type for stream ID"))+ raise JsonableError(_("Invalid data type for channel ID"))return stream_iddiff --git a/zerver/lib/string_validation.py b/zerver/lib/string_validation.pyindex b7c3f329a19..e5b387bba12 100644--- a/zerver/lib/string_validation.py+++ b/zerver/lib/string_validation.py@@ -38,11 +38,11 @@ def check_string_is_printable(var: str) -> Optional[int]:def check_stream_name(stream_name: str) -> None:if stream_name.strip() == "":- raise JsonableError(_("Stream name can't be empty!"))+ raise JsonableError(_("Channel name can't be empty."))if len(stream_name) > Stream.MAX_NAME_LENGTH:raise JsonableError(- _("Stream name too long (limit: {max_length} characters).").format(+ _("Channel name too long (limit: {max_length} characters).").format(max_length=Stream.MAX_NAME_LENGTH))@@ -50,7 +50,7 @@ def check_stream_name(stream_name: str) -> None:invalid_character_pos = check_string_is_printable(stream_name)if invalid_character_pos is not None:raise JsonableError(- _("Invalid character in stream name, at position {position}!").format(+ _("Invalid character in channel name, at position {position}.").format(position=invalid_character_pos))diff --git a/zerver/lib/subscription_info.py b/zerver/lib/subscription_info.pyindex e1abad74da3..ae312672850 100644--- a/zerver/lib/subscription_info.py+++ b/zerver/lib/subscription_info.py@@ -329,14 +329,14 @@ def validate_user_access_to_subscribers_helper(# Adding an `else` would ensure better code coverage.if not user_profile.can_access_public_streams() and not stream_dict["invite_only"]:- raise JsonableError(_("Subscriber data is not available for this stream"))+ raise JsonableError(_("Subscriber data is not available for this channel"))# Organization administrators can view subscribers for all streams.if user_profile.is_realm_admin:returnif stream_dict["invite_only"] and not check_user_subscribed(user_profile):- raise JsonableError(_("Unable to retrieve subscribers for private stream"))+ raise JsonableError(_("Unable to retrieve subscribers for private channel"))def bulk_get_subscriber_user_ids(diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yamlindex 4e3a46b0025..a068105857c 100644--- a/zerver/openapi/zulip.yaml+++ b/zerver/openapi/zulip.yaml@@ -5517,7 +5517,7 @@ paths:example:{"code": "BAD_REQUEST",- "msg": "Must specify exactly 1 stream ID for stream messages",+ "msg": "Must specify exactly 1 channel ID for channel messages","result": "error",}/drafts/{draft_id}:@@ -18321,7 +18321,7 @@ paths:- example:{"code": "BAD_REQUEST",- "msg": "Missing stream_id",+ "msg": "Missing channel ID","result": "error",}description: |diff --git a/zerver/tests/test_drafts.py b/zerver/tests/test_drafts.pyindex 2ddfb0a8111..186e69a74d9 100644--- a/zerver/tests/test_drafts.py+++ b/zerver/tests/test_drafts.py@@ -240,7 +240,7 @@ class DraftCreationTests(ZulipTestCase):}]self.create_and_check_drafts_for_error(- draft_dicts, "Must specify exactly 1 stream ID for stream messages"+ draft_dicts, "Must specify exactly 1 channel ID for channel messages")def test_create_stream_draft_for_inaccessible_stream(self) -> None:diff --git a/zerver/tests/test_message_move_stream.py b/zerver/tests/test_message_move_stream.pyindex 607b79f756c..54023cb7e1d 100644--- a/zerver/tests/test_message_move_stream.py+++ b/zerver/tests/test_message_move_stream.py@@ -76,7 +76,7 @@ class MessageMoveStreamTest(ZulipTestCase):},)- self.assert_json_error(result, "Direct messages cannot be moved to streams.")+ self.assert_json_error(result, "Direct messages cannot be moved to channels.")def test_move_message_to_stream_with_content(self) -> None:(user_profile, old_stream, new_stream, msg_id, msg_id_later) = self.prepare_move_topics(@@ -91,7 +91,7 @@ class MessageMoveStreamTest(ZulipTestCase):"content": "Not allowed",},)- self.assert_json_error(result, "Cannot change message content while changing stream")+ self.assert_json_error(result, "Cannot change message content while changing channel")messages = get_topic_messages(user_profile, old_stream, "test")self.assert_length(messages, 3)@@ -943,7 +943,7 @@ class MessageMoveStreamTest(ZulipTestCase):cordelia,test_stream_1,test_stream_2,- expect_error_message="The time limit for editing this message's stream has passed",+ expect_error_message="The time limit for editing this message's channel has passed",)# admins and moderators can move messages irrespective of time limit.diff --git a/zerver/tests/test_recipient_parsing.py b/zerver/tests/test_recipient_parsing.pyindex a485e334bff..029555186f2 100644--- a/zerver/tests/test_recipient_parsing.py+++ b/zerver/tests/test_recipient_parsing.py@@ -11,13 +11,13 @@ class TestRecipientParsing(ZulipTestCase):stream_id = extract_stream_id("1")self.assertEqual(stream_id, 1)- with self.assertRaisesRegex(JsonableError, "Invalid data type for stream ID"):+ with self.assertRaisesRegex(JsonableError, "Invalid data type for channel ID"):extract_stream_id("1,2")- with self.assertRaisesRegex(JsonableError, "Invalid data type for stream ID"):+ with self.assertRaisesRegex(JsonableError, "Invalid data type for channel ID"):extract_stream_id("[1]")- with self.assertRaisesRegex(JsonableError, "Invalid data type for stream ID"):+ with self.assertRaisesRegex(JsonableError, "Invalid data type for channel ID"):extract_stream_id("general")def test_extract_recipient_ids(self) -> None:diff --git a/zerver/tests/test_scheduled_messages.py b/zerver/tests/test_scheduled_messages.pyindex 8e492a52c5f..364af0601c4 100644--- a/zerver/tests/test_scheduled_messages.py+++ b/zerver/tests/test_scheduled_messages.py@@ -505,7 +505,7 @@ class ScheduledMessageTest(ZulipTestCase):}result = self.client_patch(f"/json/scheduled_messages/{scheduled_message_id}", payload)self.assert_json_error(- result, "Topic required when updating scheduled message type to stream."+ result, "Topic required when updating scheduled message type to channel.")# Edit message `type` to stream with valid `to` and `topic` succeedsdiff --git a/zerver/tests/test_subs.py b/zerver/tests/test_subs.pyindex 37a306a0424..f0c575fc73e 100644--- a/zerver/tests/test_subs.py+++ b/zerver/tests/test_subs.py@@ -3071,7 +3071,7 @@ class DefaultStreamGroupTest(ZulipTestCase):# Test creating a default stream group which contains a default streamdo_add_default_stream(remaining_streams[0])with self.assertRaisesRegex(- JsonableError, "'stream1' is a default stream and cannot be added to 'new group1'"+ JsonableError, "'stream1' is a default channel and cannot be added to 'new group1'"):do_create_default_stream_group(realm, new_group_name, "This is group1", remaining_streams@@ -3118,7 +3118,7 @@ class DefaultStreamGroupTest(ZulipTestCase):"stream_names": orjson.dumps(stream_names).decode(),},)- self.assert_json_error(result, "Default stream group 'group1' already exists")+ self.assert_json_error(result, "Default channel group 'group1' already exists")# Test adding streams to existing default stream groupgroup_id = default_stream_groups[0].id@@ -3156,7 +3156,7 @@ class DefaultStreamGroupTest(ZulipTestCase):{"op": "add", "stream_names": orjson.dumps(new_stream_names).decode()},)self.assert_json_error(- result, "'stream4' is a default stream and cannot be added to 'group1'"+ result, "'stream4' is a default channel and cannot be added to 'group1'")do_remove_default_stream(new_streams[0])@@ -3175,7 +3175,7 @@ class DefaultStreamGroupTest(ZulipTestCase):{"op": "add", "stream_names": orjson.dumps(new_stream_names).decode()},)self.assert_json_error(- result, "Stream 'stream4' is already present in default stream group 'group1'"+ result, "Channel 'stream4' is already present in default channel group 'group1'")# Test removing streams from default stream group@@ -3207,7 +3207,7 @@ class DefaultStreamGroupTest(ZulipTestCase):{"op": "remove", "stream_names": orjson.dumps(new_stream_names).decode()},)self.assert_json_error(- result, "Stream 'stream4' is not present in default stream group 'group1'"+ result, "Channel 'stream4' is not present in default channel group 'group1'")# Test changing description of default stream group@@ -3239,7 +3239,7 @@ class DefaultStreamGroupTest(ZulipTestCase):f"/json/default_stream_groups/{group_id}",{"new_group_name": "group2"},)- self.assert_json_error(result, "Default stream group 'group2' already exists")+ self.assert_json_error(result, "Default channel group 'group2' already exists")new_group = lookup_default_stream_groups(["group2"], realm)[0]do_remove_default_stream_group(realm, new_group)@@ -3247,7 +3247,7 @@ class DefaultStreamGroupTest(ZulipTestCase):f"/json/default_stream_groups/{group_id}",{"new_group_name": group_name},)- self.assert_json_error(result, "This default stream group is already named 'group1'")+ self.assert_json_error(result, "This default channel group is already named 'group1'")result = self.client_patch(f"/json/default_stream_groups/{group_id}",@@ -3288,7 +3288,7 @@ class DefaultStreamGroupTest(ZulipTestCase):"stream_names": orjson.dumps(stream_names).decode(),},)- self.assert_json_error(result, "Invalid default stream group name ''")+ self.assert_json_error(result, "Invalid default channel group name ''")result = self.client_post("/json/default_stream_groups/create",@@ -3300,7 +3300,7 @@ class DefaultStreamGroupTest(ZulipTestCase):)self.assert_json_error(result,- f"Default stream group name too long (limit: {DefaultStreamGroup.MAX_NAME_LENGTH} characters)",+ f"Default channel group name too long (limit: {DefaultStreamGroup.MAX_NAME_LENGTH} characters)",)result = self.client_post(@@ -3312,14 +3312,14 @@ class DefaultStreamGroupTest(ZulipTestCase):},)self.assert_json_error(- result, "Default stream group name 'abc\000' contains NULL (0x00) characters."+ result, "Default channel group name 'abc\000' contains NULL (0x00) characters.")# Also test that lookup_default_stream_groups raises an# error if we pass it a bad name. This function is used# during registration, but it's a bit heavy to do a full# test of that.- with self.assertRaisesRegex(JsonableError, "Invalid default stream group invalid-name"):+ with self.assertRaisesRegex(JsonableError, "Invalid default channel group invalid-name"):lookup_default_stream_groups(["invalid-name"], realm)@@ -3917,7 +3917,7 @@ class SubscriptionRestApiTest(ZulipTestCase):"delete": orjson.dumps([invalid_stream_name]).decode(),}result = self.api_patch(user, "/api/v1/users/me/subscriptions", request)- self.assert_json_error(result, "Stream name can't be empty!")+ self.assert_json_error(result, "Channel name can't be empty.")def test_stream_name_too_long(self) -> None:user = self.example_user("hamlet")@@ -3928,7 +3928,7 @@ class SubscriptionRestApiTest(ZulipTestCase):"delete": orjson.dumps([long_stream_name]).decode(),}result = self.api_patch(user, "/api/v1/users/me/subscriptions", request)- self.assert_json_error(result, "Stream name too long (limit: 60 characters).")+ self.assert_json_error(result, "Channel name too long (limit: 60 characters).")def test_stream_name_contains_null(self) -> None:user = self.example_user("hamlet")@@ -3939,7 +3939,7 @@ class SubscriptionRestApiTest(ZulipTestCase):"delete": orjson.dumps([stream_name]).decode(),}result = self.api_patch(user, "/api/v1/users/me/subscriptions", request)- self.assert_json_error(result, "Invalid character in stream name, at position 4!")+ self.assert_json_error(result, "Invalid character in channel name, at position 4.")def test_compose_views_rollback(self) -> None:"""@@ -4015,7 +4015,7 @@ class SubscriptionAPITest(ZulipTestCase):result = self.api_post(user, "/api/v1/users/me/subscriptions", post_data_cc, subdomain="zulip")- self.assert_json_error(result, "Invalid character in stream name, at position 4!")+ self.assert_json_error(result, "Invalid character in channel name, at position 4.")# For Cn categorypost_data_cn = {@@ -4027,7 +4027,7 @@ class SubscriptionAPITest(ZulipTestCase):result = self.api_post(user, "/api/v1/users/me/subscriptions", post_data_cn, subdomain="zulip")- self.assert_json_error(result, "Invalid character in stream name, at position 4!")+ self.assert_json_error(result, "Invalid character in channel name, at position 4.")def test_invalid_stream_rename(self) -> None:"""@@ -4039,16 +4039,16 @@ class SubscriptionAPITest(ZulipTestCase):do_change_user_role(user_profile, UserProfile.ROLE_REALM_ADMINISTRATOR, acting_user=None)# Check for empty nameresult = self.client_patch(f"/json/streams/{stream.id}", {"new_name": ""})- self.assert_json_error(result, "Stream name can't be empty!")+ self.assert_json_error(result, "Channel name can't be empty.")# Check for long nameresult = self.client_patch(f"/json/streams/{stream.id}", {"new_name": "a" * 61})- self.assert_json_error(result, "Stream name too long (limit: 60 characters).")+ self.assert_json_error(result, "Channel name too long (limit: 60 characters).")# Check for Cc charactersresult = self.client_patch(f"/json/streams/{stream.id}", {"new_name": "test\n\rname"})- self.assert_json_error(result, "Invalid character in stream name, at position 5!")+ self.assert_json_error(result, "Invalid character in channel name, at position 5.")# Check for Cn charactersresult = self.client_patch(f"/json/streams/{stream.id}", {"new_name": "test\ufffeame"})- self.assert_json_error(result, "Invalid character in stream name, at position 5!")+ self.assert_json_error(result, "Invalid character in channel name, at position 5.")def test_successful_subscriptions_list(self) -> None:"""@@ -4329,7 +4329,7 @@ class SubscriptionAPITest(ZulipTestCase):result = self.common_subscribe_to_streams(self.test_user, [long_stream_name], allow_fail=True)- self.assert_json_error(result, "Stream name too long (limit: 60 characters).")+ self.assert_json_error(result, "Channel name too long (limit: 60 characters).")def test_subscriptions_add_stream_with_null(self) -> None:"""@@ -4338,7 +4338,7 @@ class SubscriptionAPITest(ZulipTestCase):"""stream_name = "abc\000"result = self.common_subscribe_to_streams(self.test_user, [stream_name], allow_fail=True)- self.assert_json_error(result, "Invalid character in stream name, at position 4!")+ self.assert_json_error(result, "Invalid character in channel name, at position 4.")def _test_user_settings_for_creating_streams(self,@@ -4594,7 +4594,7 @@ class SubscriptionAPITest(ZulipTestCase):result = self.common_subscribe_to_streams(self.test_user, [invalid_stream_name], allow_fail=True)- self.assert_json_error(result, "Stream name can't be empty!")+ self.assert_json_error(result, "Channel name can't be empty.")def assert_adding_subscriptions_for_principal(self,diff --git a/zerver/tests/test_typing.py b/zerver/tests/test_typing.pyindex 9e94e226c75..80fee5033c8 100644--- a/zerver/tests/test_typing.py+++ b/zerver/tests/test_typing.py@@ -105,7 +105,7 @@ class TypingValidateStreamIdTopicArgumentsTest(ZulipTestCase):"/api/v1/typing",{"type": "stream", "op": "start", "topic": "test"},)- self.assert_json_error(result, "Missing stream_id")+ self.assert_json_error(result, "Missing 'stream_id' argument")def test_invalid_stream_id(self) -> None:"""@@ -583,7 +583,9 @@ class TestSendTypingNotificationsSettings(ZulipTestCase):# No events should be sent nowwith self.capture_send_event_calls(expected_num_events=0) as events:result = self.api_post(sender, "/api/v1/typing", params)- self.assert_json_error(result, "User has disabled typing notifications for stream messages")+ self.assert_json_error(+ result, "User has disabled typing notifications for channel messages"+ )self.assertEqual(events, [])def test_typing_notifications_disabled(self) -> None:diff --git a/zerver/views/scheduled_messages.py b/zerver/views/scheduled_messages.pyindex ec1412291d9..cc01ef047ff 100644--- a/zerver/views/scheduled_messages.py+++ b/zerver/views/scheduled_messages.py@@ -73,7 +73,7 @@ def update_scheduled_message_backend(recipient_type_name = "stream"if recipient_type_name is not None and recipient_type_name == "stream" and topic_name is None:- raise JsonableError(_("Topic required when updating scheduled message type to stream."))+ raise JsonableError(_("Topic required when updating scheduled message type to channel."))if recipient_type_name is not None and recipient_type_name == "direct":# For now, use "private" from Message.API_RECIPIENT_TYPES.diff --git a/zerver/views/typing.py b/zerver/views/typing.pyindex 028d5db6675..57f5f1c3a95 100644--- a/zerver/views/typing.py+++ b/zerver/views/typing.py@@ -38,13 +38,13 @@ def send_notification_backend(if recipient_type_name == "stream":if stream_id is None:- raise JsonableError(_("Missing stream_id"))+ raise JsonableError(_("Missing '{var_name}' argument").format(var_name="stream_id"))if topic is None:raise JsonableError(_("Missing topic"))if not user_profile.send_stream_typing_notifications:- raise JsonableError(_("User has disabled typing notifications for stream messages"))+ raise JsonableError(_("User has disabled typing notifications for channel messages"))# Verify that the user has access to the stream and has# permission to send messages to it.