stream/group settings: Improve error strings.

- Use proper punctuation.
- Make errors friendlier.
This commit is contained in:
Alya Abbott 2024-02-23 21:40:57 -08:00 committed by Tim Abbott
parent 32837a8ae4
commit f0cf4dad04
3 changed files with 10 additions and 8 deletions

View File

@ -108,13 +108,13 @@ async function test_streams_with_empty_names_cannot_be_created(page: Page): Prom
await page.waitForSelector("form#stream_creation_form", {visible: true});
await common.fill_form(page, "form#stream_creation_form", {stream_name: " "});
await page.click("form#stream_creation_form button.finalize_create_stream");
assert.strictEqual(await stream_name_error(page), "A stream needs to have a name");
assert.strictEqual(await stream_name_error(page), "Choose a name for the new stream.");
}
async function test_streams_with_duplicate_names_cannot_be_created(page: Page): Promise<void> {
await common.fill_form(page, "form#stream_creation_form", {stream_name: "Puppeteer"});
await page.click("form#stream_creation_form button.finalize_create_stream");
assert.strictEqual(await stream_name_error(page), "A stream with this name already exists");
assert.strictEqual(await stream_name_error(page), "A stream with this name already exists.");
const cancel_button_selector = "form#stream_creation_form button.button.white";
await page.click(cancel_button_selector);

View File

@ -36,7 +36,7 @@ export function get_name() {
class StreamSubscriptionError {
report_no_subs_to_stream() {
$("#stream_subscription_error").text(
$t({defaultMessage: "You cannot create a stream with no subscribers!"}),
$t({defaultMessage: "You cannot create a stream with no subscribers."}),
);
$("#stream_subscription_error").show();
}
@ -60,7 +60,7 @@ const stream_subscription_error = new StreamSubscriptionError();
class StreamNameError {
report_already_exists() {
$("#stream_name_error").text(
$t({defaultMessage: "A stream with this name already exists"}),
$t({defaultMessage: "A stream with this name already exists."}),
);
$("#stream_name_error").show();
}
@ -70,7 +70,7 @@ class StreamNameError {
}
report_empty_stream() {
$("#stream_name_error").text($t({defaultMessage: "A stream needs to have a name"}));
$("#stream_name_error").text($t({defaultMessage: "Choose a name for the new stream."}));
$("#stream_name_error").show();
}

View File

@ -28,7 +28,7 @@ export function get_name() {
class UserGroupMembershipError {
report_no_members_to_user_group() {
$("#user_group_membership_error").text(
$t({defaultMessage: "You cannot create a user group with no members!"}),
$t({defaultMessage: "You cannot create a user group with no members."}),
);
$("#user_group_membership_error").show();
}
@ -42,7 +42,7 @@ const user_group_membership_error = new UserGroupMembershipError();
class UserGroupNameError {
report_already_exists() {
$("#user_group_name_error").text(
$t({defaultMessage: "A user group with this name already exists"}),
$t({defaultMessage: "A user group with this name already exists."}),
);
$("#user_group_name_error").show();
}
@ -52,7 +52,9 @@ class UserGroupNameError {
}
report_empty_user_group() {
$("#user_group_name_error").text($t({defaultMessage: "A user group needs to have a name"}));
$("#user_group_name_error").text(
$t({defaultMessage: "Choose a name for the new user group."}),
);
$("#user_group_name_error").show();
}