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.

message: Show error while resolving/unresolving topic.

Sahil Batra7f4f905ec8ef
diff --git a/web/src/compose.js b/web/src/compose.js
index 1eacf7a54ac..f0331996708 100644
--- a/web/src/compose.js
+++ b/web/src/compose.js
@@ -523,7 +523,7 @@ export function initialize() {
const topic_name = $target.attr("data-topic-name");
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);
});
},
diff --git a/web/src/message_edit.js b/web/src/message_edit.js
index ce556f54913..aace41d89f1 100644
--- a/web/src/message_edit.js
+++ b/web/src/message_edit.js
@@ -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;
const topic_is_resolved = resolved_topic.is_resolved(old_topic_name);
if (topic_is_resolved) {
@@ -719,6 +719,12 @@ export function toggle_resolve_topic(message_id, old_topic_name) {
error(xhr) {
if (xhr.responseJSON.code === "MOVE_MESSAGES_TIME_LIMIT_EXCEEDED") {
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);
}
},
});
diff --git a/web/src/popover_menus.js b/web/src/popover_menus.js
index 8379dc90d50..e0ad80d97bd 100644
--- a/web/src/popover_menus.js
+++ b/web/src/popover_menus.js
@@ -535,7 +535,7 @@ export function initialize() {
$popper.one("click", ".sidebar-popover-toggle-resolved", () => {
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();
diff --git a/web/src/ui_report.ts b/web/src/ui_report.ts
index 55e29888ffa..5763bdc3dbd 100644
--- a/web/src/ui_report.ts
+++ b/web/src/ui_report.ts
@@ -64,11 +64,17 @@ export function success(response_html: string, $status_box: JQuery, 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 $exit = $("<div>").addClass("exit");
$(".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 {