mirror of https://github.com/zulip/zulip.git
message: Show error while resolving/unresolving topic.
We were not showing the error, if any, when resolving and unresolving the topic using topic popover in left sidebar or using the banner in compose box. This commit adds code to show the error in the message feed where we show other errors like connection error, etc.
This commit is contained in:
parent
457ff73082
commit
7f4f905ec8
|
@ -523,7 +523,7 @@ export function initialize() {
|
||||||
const topic_name = $target.attr("data-topic-name");
|
const topic_name = $target.attr("data-topic-name");
|
||||||
|
|
||||||
message_edit.with_first_message_id(stream_id, topic_name, (message_id) => {
|
message_edit.with_first_message_id(stream_id, topic_name, (message_id) => {
|
||||||
message_edit.toggle_resolve_topic(message_id, topic_name);
|
message_edit.toggle_resolve_topic(message_id, topic_name, true);
|
||||||
compose_validate.clear_topic_resolved_warning(true);
|
compose_validate.clear_topic_resolved_warning(true);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -697,7 +697,7 @@ function handle_resolve_topic_failure_due_to_time_limit(topic_is_resolved) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function toggle_resolve_topic(message_id, old_topic_name) {
|
export function toggle_resolve_topic(message_id, old_topic_name, report_errors_in_global_banner) {
|
||||||
let new_topic_name;
|
let new_topic_name;
|
||||||
const topic_is_resolved = resolved_topic.is_resolved(old_topic_name);
|
const topic_is_resolved = resolved_topic.is_resolved(old_topic_name);
|
||||||
if (topic_is_resolved) {
|
if (topic_is_resolved) {
|
||||||
|
@ -719,6 +719,12 @@ export function toggle_resolve_topic(message_id, old_topic_name) {
|
||||||
error(xhr) {
|
error(xhr) {
|
||||||
if (xhr.responseJSON.code === "MOVE_MESSAGES_TIME_LIMIT_EXCEEDED") {
|
if (xhr.responseJSON.code === "MOVE_MESSAGES_TIME_LIMIT_EXCEEDED") {
|
||||||
handle_resolve_topic_failure_due_to_time_limit(topic_is_resolved);
|
handle_resolve_topic_failure_due_to_time_limit(topic_is_resolved);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (report_errors_in_global_banner) {
|
||||||
|
const error_msg = JSON.parse(xhr.responseText).msg;
|
||||||
|
ui_report.generic_embed_error(error_msg, 3500);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -535,7 +535,7 @@ export function initialize() {
|
||||||
|
|
||||||
$popper.one("click", ".sidebar-popover-toggle-resolved", () => {
|
$popper.one("click", ".sidebar-popover-toggle-resolved", () => {
|
||||||
message_edit.with_first_message_id(stream_id, topic_name, (message_id) => {
|
message_edit.with_first_message_id(stream_id, topic_name, (message_id) => {
|
||||||
message_edit.toggle_resolve_topic(message_id, topic_name);
|
message_edit.toggle_resolve_topic(message_id, topic_name, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
instance.hide();
|
instance.hide();
|
||||||
|
|
|
@ -64,11 +64,17 @@ export function success(response_html: string, $status_box: JQuery, remove_after
|
||||||
message(response_html, $status_box, "alert-success", remove_after);
|
message(response_html, $status_box, "alert-success", remove_after);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function generic_embed_error(error_html: string): void {
|
export function generic_embed_error(error_html: string, remove_after: number): void {
|
||||||
const $alert = $("<div>").addClass(["alert", "home-error-bar", "show"]);
|
const $alert = $("<div>").addClass(["alert", "home-error-bar", "show"]);
|
||||||
const $exit = $("<div>").addClass("exit");
|
const $exit = $("<div>").addClass("exit");
|
||||||
|
|
||||||
$(".alert-box").append($alert.append($exit, $("<div>").addClass("content").html(error_html)));
|
$(".alert-box").append($alert.append($exit, $("<div>").addClass("content").html(error_html)));
|
||||||
|
|
||||||
|
if (remove_after !== undefined) {
|
||||||
|
setTimeout(() => {
|
||||||
|
$alert.fadeOut(400);
|
||||||
|
}, remove_after);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function generic_row_button_error(xhr: JQuery.jqXHR, $btn: JQuery): void {
|
export function generic_row_button_error(xhr: JQuery.jqXHR, $btn: JQuery): void {
|
||||||
|
|
Loading…
Reference in New Issue