Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
streams: Send PATCH request for stream rename only if name is changed.
sahil8396bad8b23fcd8
diff --git a/static/js/stream_edit.js b/static/js/stream_edit.jsindex 6d394034e9f..2d8ac13c5cd 100644--- a/static/js/stream_edit.js+++ b/static/js/stream_edit.js@@ -552,8 +552,14 @@ exports.change_stream_name = function (e) {const stream_id = get_stream_id(e.target);const new_name_box = sub_settings.find(".stream-name-editable");const new_name = new_name_box.text().trim();+ const old_name = stream_data.maybe_get_stream_name(stream_id);+$(".stream_change_property_info").hide();+ if (old_name === new_name) {+ return;+ }+channel.patch({// Stream names might contain unsafe characters so we must encode it first.url: "/json/streams/" + stream_id,@@ -566,7 +572,7 @@ exports.change_stream_name = function (e) {);},error(xhr) {- new_name_box.text(stream_data.maybe_get_stream_name(stream_id));+ new_name_box.text(old_name);ui_report.error(i18n.t("Error"), xhr, $(".stream_change_property_info"));},});