Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

ui_report: Migrate ui_report.message to ui_report.client_error.

Ganesh Pawar632abd45ebd9
diff --git a/static/js/blueslip.js b/static/js/blueslip.js
index 48c26e75f55..2fdbf81b6b6 100644
--- a/static/js/blueslip.js
+++ b/static/js/blueslip.js
@@ -142,22 +142,20 @@ function report_error(msg, stack, opts) {
// invoked). In any case, it will pretty clear that
// something is wrong with the page and the user will
// probably try to reload anyway.
- ui_report.message(
+ ui_report.client_error(
"Oops. It seems something has gone wrong. " +
"The error has been reported to the fine " +
"folks at Zulip, but, in the mean time, " +
"please try reloading the page.",
$("#home-error"),
- "alert-error",
);
}
},
error() {
if (opts.show_ui_msg && ui_report !== undefined) {
- ui_report.message(
+ ui_report.client_error(
"Oops. It seems something has gone wrong. Please try reloading the page.",
$("#home-error"),
- "alert-error",
);
}
},
diff --git a/static/js/settings_emoji.js b/static/js/settings_emoji.js
index 1b36b34b502..b8229a11922 100644
--- a/static/js/settings_emoji.js
+++ b/static/js/settings_emoji.js
@@ -183,11 +183,7 @@ exports.set_up = function () {
}
if (emoji.name.trim() === "") {
- ui_report.message(
- i18n.t("Failed: Emoji name is required."),
- emoji_status,
- "alert-error",
- );
+ ui_report.client_error(i18n.t("Failed: Emoji name is required."), emoji_status);
return;
}
$("#admin_emoji_submit").prop("disabled", true);
diff --git a/static/js/settings_invites.js b/static/js/settings_invites.js
index a57ff0c8455..1feae4a67c1 100644
--- a/static/js/settings_invites.js
+++ b/static/js/settings_invites.js
@@ -93,10 +93,9 @@ function do_revoke_invite() {
if (modal_invite_id !== meta.invite_id || modal_is_multiuse !== meta.is_multiuse) {
blueslip.error("Invite revoking canceled due to non-matching fields.");
- ui_report.message(
+ ui_report.client_error(
i18n.t("Resending encountered an error. Please reload and try again."),
$("#home-error"),
- "alert-error",
);
}
$("#revoke_invite_modal").modal("hide");
@@ -196,10 +195,9 @@ exports.on_load_success = function (invites_data, initialize_event_handlers) {
if (modal_invite_id !== meta.invite_id) {
blueslip.error("Invite resending canceled due to non-matching fields.");
- ui_report.message(
+ ui_report.client_error(
i18n.t("Resending encountered an error. Please reload and try again."),
$("#home-error"),
- "alert-error",
);
}
$("#resend_invite_modal").modal("hide");
diff --git a/static/js/stream_create.js b/static/js/stream_create.js
index 6e04f20d3fc..4fd812b247b 100644
--- a/static/js/stream_create.js
+++ b/static/js/stream_create.js
@@ -146,10 +146,9 @@ function create_stream() {
// newline characters (by pressing the Enter key) it would still be possible to copy
// and paste over a description with newline characters in it. Prevent that.
if (description.includes("\n")) {
- ui_report.message(
+ ui_report.client_error(
i18n.t("The stream description cannot contain newline characters."),
$(".stream_create_info"),
- "alert-error",
);
return undefined;
}
diff --git a/static/js/stream_edit.js b/static/js/stream_edit.js
index 5bbd673ee53..46545faa518 100644
--- a/static/js/stream_edit.js
+++ b/static/js/stream_edit.js
@@ -815,11 +815,7 @@ exports.initialize = function () {
const stream_id = get_stream_id(e.target);
if (!stream_id) {
- ui_report.message(
- i18n.t("Invalid stream id"),
- $(".stream_change_property_info"),
- "alert-error",
- );
+ ui_report.client_error(i18n.t("Invalid stream id"), $(".stream_change_property_info"));
return;
}
const stream_name = stream_data.maybe_get_stream_name(stream_id);
@@ -837,11 +833,7 @@ exports.initialize = function () {
overlays.close_modal("#deactivation_stream_modal");
$("#deactivation_stream_modal").remove();
if (!stream_id) {
- ui_report.message(
- i18n.t("Invalid stream id"),
- $(".stream_change_property_info"),
- "alert-error",
- );
+ ui_report.client_error(i18n.t("Invalid stream id"), $(".stream_change_property_info"));
return;
}
const row = $(".stream-row.active");