Skip to content

Commit 632abd4

Browse files
ganpa3timabbott
authored andcommitted
ui_report: Migrate ui_report.message to ui_report.client_error.
1 parent 5802bbf commit 632abd4

File tree

5 files changed

+8
-25
lines changed

5 files changed

+8
-25
lines changed

static/js/blueslip.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,22 +142,20 @@ function report_error(msg, stack, opts) {
142142
// invoked). In any case, it will pretty clear that
143143
// something is wrong with the page and the user will
144144
// probably try to reload anyway.
145-
ui_report.message(
145+
ui_report.client_error(
146146
"Oops. It seems something has gone wrong. " +
147147
"The error has been reported to the fine " +
148148
"folks at Zulip, but, in the mean time, " +
149149
"please try reloading the page.",
150150
$("#home-error"),
151-
"alert-error",
152151
);
153152
}
154153
},
155154
error() {
156155
if (opts.show_ui_msg && ui_report !== undefined) {
157-
ui_report.message(
156+
ui_report.client_error(
158157
"Oops. It seems something has gone wrong. Please try reloading the page.",
159158
$("#home-error"),
160-
"alert-error",
161159
);
162160
}
163161
},

static/js/settings_emoji.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,7 @@ exports.set_up = function () {
183183
}
184184

185185
if (emoji.name.trim() === "") {
186-
ui_report.message(
187-
i18n.t("Failed: Emoji name is required."),
188-
emoji_status,
189-
"alert-error",
190-
);
186+
ui_report.client_error(i18n.t("Failed: Emoji name is required."), emoji_status);
191187
return;
192188
}
193189
$("#admin_emoji_submit").prop("disabled", true);

static/js/settings_invites.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,9 @@ function do_revoke_invite() {
9393

9494
if (modal_invite_id !== meta.invite_id || modal_is_multiuse !== meta.is_multiuse) {
9595
blueslip.error("Invite revoking canceled due to non-matching fields.");
96-
ui_report.message(
96+
ui_report.client_error(
9797
i18n.t("Resending encountered an error. Please reload and try again."),
9898
$("#home-error"),
99-
"alert-error",
10099
);
101100
}
102101
$("#revoke_invite_modal").modal("hide");
@@ -196,10 +195,9 @@ exports.on_load_success = function (invites_data, initialize_event_handlers) {
196195

197196
if (modal_invite_id !== meta.invite_id) {
198197
blueslip.error("Invite resending canceled due to non-matching fields.");
199-
ui_report.message(
198+
ui_report.client_error(
200199
i18n.t("Resending encountered an error. Please reload and try again."),
201200
$("#home-error"),
202-
"alert-error",
203201
);
204202
}
205203
$("#resend_invite_modal").modal("hide");

static/js/stream_create.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,9 @@ function create_stream() {
146146
// newline characters (by pressing the Enter key) it would still be possible to copy
147147
// and paste over a description with newline characters in it. Prevent that.
148148
if (description.includes("\n")) {
149-
ui_report.message(
149+
ui_report.client_error(
150150
i18n.t("The stream description cannot contain newline characters."),
151151
$(".stream_create_info"),
152-
"alert-error",
153152
);
154153
return undefined;
155154
}

static/js/stream_edit.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -815,11 +815,7 @@ exports.initialize = function () {
815815

816816
const stream_id = get_stream_id(e.target);
817817
if (!stream_id) {
818-
ui_report.message(
819-
i18n.t("Invalid stream id"),
820-
$(".stream_change_property_info"),
821-
"alert-error",
822-
);
818+
ui_report.client_error(i18n.t("Invalid stream id"), $(".stream_change_property_info"));
823819
return;
824820
}
825821
const stream_name = stream_data.maybe_get_stream_name(stream_id);
@@ -837,11 +833,7 @@ exports.initialize = function () {
837833
overlays.close_modal("#deactivation_stream_modal");
838834
$("#deactivation_stream_modal").remove();
839835
if (!stream_id) {
840-
ui_report.message(
841-
i18n.t("Invalid stream id"),
842-
$(".stream_change_property_info"),
843-
"alert-error",
844-
);
836+
ui_report.client_error(i18n.t("Invalid stream id"), $(".stream_change_property_info"));
845837
return;
846838
}
847839
const row = $(".stream-row.active");

0 commit comments

Comments
 (0)