mirror of
https://github.com/zulip/zulip.git
synced 2025-11-13 10:26:28 +00:00
alert_words: Update label in the alert words removal status banner.
This commit displays the removed alert word in the error banner, and bolds the alert word in both success and error banners.
This commit is contained in:
@@ -340,7 +340,7 @@ async function delete_alert_word(page: Page, word: string): Promise<void> {
|
||||
async function test_alert_word_deletion(page: Page, word: string): Promise<void> {
|
||||
await delete_alert_word(page, word);
|
||||
const status_text = await get_alert_words_status_text(page);
|
||||
assert.strictEqual(status_text, `Alert word "${word}" removed successfully!`);
|
||||
assert.strictEqual(status_text, `Alert word ${word} removed successfully!`);
|
||||
await close_alert_words_status(page);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import Handlebars from "handlebars";
|
||||
import $ from "jquery";
|
||||
|
||||
import render_add_alert_word from "../templates/settings/add_alert_word.hbs";
|
||||
@@ -50,12 +51,19 @@ const open_alert_word_status_banner = (alert_word: string, is_error: boolean): v
|
||||
custom_classes: "alert-word-status-banner",
|
||||
};
|
||||
if (is_error) {
|
||||
alert_word_status_banner.label = $t({defaultMessage: "Error removing alert word!"});
|
||||
alert_word_status_banner.label = new Handlebars.SafeString(
|
||||
$t_html(
|
||||
{defaultMessage: "Error removing alert word <b>{alert_word}</b>!"},
|
||||
{alert_word},
|
||||
),
|
||||
);
|
||||
alert_word_status_banner.intent = "danger";
|
||||
} else {
|
||||
alert_word_status_banner.label = $t(
|
||||
{defaultMessage: `Alert word "{alert_word}" removed successfully!`},
|
||||
alert_word_status_banner.label = new Handlebars.SafeString(
|
||||
$t_html(
|
||||
{defaultMessage: "Alert word <b>{alert_word}</b> removed successfully!"},
|
||||
{alert_word},
|
||||
),
|
||||
);
|
||||
alert_word_status_banner.intent = "success";
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ run_test("remove_alert_word", ({override_rewire}) => {
|
||||
assert.ok($alert_word_status_banner.hasClass("banner-danger"));
|
||||
assert.equal(
|
||||
$alert_word_status_banner_label.text(),
|
||||
"translated: Error removing alert word!",
|
||||
`translated HTML: Error removing alert word <b>translated: zot</b>!`,
|
||||
);
|
||||
|
||||
// test success
|
||||
@@ -99,6 +99,6 @@ run_test("remove_alert_word", ({override_rewire}) => {
|
||||
assert.ok($alert_word_status_banner.hasClass("banner-success"));
|
||||
assert.equal(
|
||||
$alert_word_status_banner_label.text(),
|
||||
`translated: Alert word "translated: zot" removed successfully!`,
|
||||
`translated HTML: Alert word <b>translated: zot</b> removed successfully!`,
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user