mirror of https://github.com/zulip/zulip.git
i18n: Update translated errors for stream to channel rename.
Updates various areas of the backend code that generate JsonableErrors with translated strings to use channel instead of stream. Part of stream to channel rename project.
This commit is contained in:
parent
df3ab8deea
commit
9be4d07442
|
@ -17,11 +17,11 @@ from zerver.tornado.django_api import send_event_on_commit
|
|||
def 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
|
||||
)
|
||||
)
|
||||
|
|
|
@ -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 (
|
||||
|
|
|
@ -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 stream
|
||||
stream_name_or_id = sender.default_sending_stream_id
|
||||
else:
|
||||
raise JsonableError(_("Missing stream"))
|
||||
raise JsonableError(_("Missing channel"))
|
||||
|
||||
if topic_name is None:
|
||||
raise JsonableError(_("Missing topic"))
|
||||
|
|
|
@ -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_id
|
||||
elif draft_dict.type == "private" and len(to) != 0:
|
||||
|
|
|
@ -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_id
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
)
|
||||
)
|
||||
|
|
|
@ -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:
|
||||
return
|
||||
|
||||
if 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(
|
||||
|
|
|
@ -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: |
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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` succeeds
|
||||
|
|
|
@ -3071,7 +3071,7 @@ class DefaultStreamGroupTest(ZulipTestCase):
|
|||
# Test creating a default stream group which contains a default stream
|
||||
do_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 group
|
||||
group_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 category
|
||||
post_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 name
|
||||
result = 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 name
|
||||
result = 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 characters
|
||||
result = 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 characters
|
||||
result = 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,
|
||||
|
|
|
@ -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 now
|
||||
with 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:
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue