ui_report: Migrate ui_report.message to ui_report.client_error.

This commit is contained in:
Ganesh Pawar
2021-01-27 12:46:28 +05:30
committed by Tim Abbott
parent 5802bbfb98
commit 632abd45eb
5 changed files with 8 additions and 25 deletions

View File

@@ -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",
);
}
},

View File

@@ -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);

View File

@@ -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");

View File

@@ -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;
}

View File

@@ -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");