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.

move_topic_modal: Use `dialog_error` to display error.

Ganesh Pawar19c4a63d51a4
diff --git a/static/js/message_edit.js b/static/js/message_edit.js
index 1c50453c0b3..f306d0cc0ec 100644
--- a/static/js/message_edit.js
+++ b/static/js/message_edit.js
@@ -1063,10 +1063,10 @@ export function move_topic_containing_message_to_stream(
dialog_widget.close_modal();
}
if (currently_topic_editing_messages.includes(message_id)) {
- $("#topic_stream_edit_form_error .error-msg").text(
- $t({defaultMessage: "A Topic Move already in progress."}),
+ ui_report.client_error(
+ $t_html({defaultMessage: "A Topic Move already in progress."}),
+ $("#move_topic_modal #dialog_error"),
);
- $("#topic_stream_edit_form_error").show();
return;
}
currently_topic_editing_messages.push(message_id);
diff --git a/static/js/stream_popover.js b/static/js/stream_popover.js
index 56222bff498..cb137e460a6 100644
--- a/static/js/stream_popover.js
+++ b/static/js/stream_popover.js
@@ -33,6 +33,7 @@ import * as stream_color from "./stream_color";
import * as stream_data from "./stream_data";
import * as stream_settings_ui from "./stream_settings_ui";
import * as sub_store from "./sub_store";
+import * as ui_report from "./ui_report";
import * as unread_ops from "./unread_ops";
import {user_settings} from "./user_settings";
@@ -405,11 +406,6 @@ function build_move_topic_to_stream_popover(e, current_stream_id, topic_name) {
hide_topic_popover();
function move_topic() {
- function show_error_msg(msg) {
- $("#topic_stream_edit_form_error .error-msg").text(msg);
- $("#topic_stream_edit_form_error").show();
- }
-
const params = Object.fromEntries(
$("#move_topic_form")
.serializeArray()
@@ -435,7 +431,10 @@ function build_move_topic_to_stream_popover(e, current_stream_id, topic_name) {
new_topic_name.toLowerCase() === old_topic_name.toLowerCase()
) {
dialog_widget.hide_dialog_spinner();
- show_error_msg("Please select a different stream or change topic name.");
+ ui_report.client_error(
+ $t_html({defaultMessage: "Please select a different stream or change topic name."}),
+ $("#move_topic_modal #dialog_error"),
+ );
return;
}
@@ -462,7 +461,11 @@ function build_move_topic_to_stream_popover(e, current_stream_id, topic_name) {
},
(xhr) => {
dialog_widget.hide_dialog_spinner();
- show_error_msg(xhr.responseJSON.msg);
+ ui_report.error(
+ $t_html({defaultMessage: "Error moving topic"}),
+ xhr,
+ $("#move_topic_modal #dialog_error"),
+ );
},
);
}
@@ -815,8 +818,4 @@ export function register_topic_handlers() {
e.stopPropagation();
e.preventDefault();
});
-
- $("body").on("click", "#topic_stream_edit_form_error .send-status-close", () => {
- $("#topic_stream_edit_form_error").hide();
- });
}
diff --git a/static/styles/popovers.css b/static/styles/popovers.css
index 7e95599c5c3..793f2d1971c 100644
--- a/static/styles/popovers.css
+++ b/static/styles/popovers.css
@@ -695,11 +695,6 @@ ul {
margin-bottom: 10px;
}
- #topic_stream_edit_form_error {
- background-color: hsla(0, 70%, 87%, 0.7);
- color: hsl(0, 100%, 50%);
- }
-
.topic_stream_edit_header {
display: flex;
flex-wrap: wrap;
diff --git a/static/templates/move_topic_to_stream.hbs b/static/templates/move_topic_to_stream.hbs
index d80258489d4..0a5e478473f 100644
--- a/static/templates/move_topic_to_stream.hbs
+++ b/static/templates/move_topic_to_stream.hbs
@@ -1,9 +1,5 @@
<p>{{#tr}}Move all messages in <strong>{topic_name}</strong>{{/tr}} to:</p>
<form class="new-style" id="move_topic_form">
- <div id="topic_stream_edit_form_error" class="alert">
- <span class="send-status-close">&times;</span>
- <span class="error-msg"></span>
- </div>
<p>{{t "Select a stream below or change topic name." }}</p>
<div class="topic_stream_edit_header">
<div class="stream_header_colorblock"></div>