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.

stream_popover: Extract method to show error message in topic edit.

Aman Agrawalbaf01795a99f
diff --git a/static/js/stream_popover.js b/static/js/stream_popover.js
index 6c758727622..e0304325117 100644
--- a/static/js/stream_popover.js
+++ b/static/js/stream_popover.js
@@ -549,6 +549,11 @@ exports.register_topic_handlers = function () {
});
$('body').on('click', '#do_move_topic_button', function (e) {
+ function show_error_msg(msg) {
+ $("#topic_stream_edit_form_error .error-msg").text(msg);
+ $("#topic_stream_edit_form_error").show();
+ }
+
const params = $('#move_topic_form').serializeArray().reduce(function (obj, item) {
obj[item.name] = item.value;
return obj;
@@ -608,8 +613,7 @@ exports.register_topic_handlers = function () {
}
},
error: function (xhr) {
- $("#topic_stream_edit_form_error .error-msg").text(xhr.responseJSON.msg);
- $("#topic_stream_edit_form_error").show();
+ show_error_msg(xhr.responseJSON.msg);
},
});
e.preventDefault();