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-edit: Add maxlength attribute for editing topic names.

jai2201511c589e2d75
diff --git a/static/js/message_edit.js b/static/js/message_edit.js
index 9ff2e22145c..3e9ddebc951 100644
--- a/static/js/message_edit.js
+++ b/static/js/message_edit.js
@@ -710,7 +710,11 @@ export function toggle_resolve_topic(message_id, old_topic_name) {
}
export function start_inline_topic_edit($recipient_row) {
- const $form = $(render_topic_edit_form());
+ const $form = $(
+ render_topic_edit_form({
+ max_topic_length: page_params.max_topic_length,
+ }),
+ );
message_lists.current.show_edit_topic_on_recipient_row($recipient_row, $form);
$form.on("keydown", handle_inline_topic_edit_keydown);
$(".topic_edit_spinner").hide();
diff --git a/static/templates/topic_edit_form.hbs b/static/templates/topic_edit_form.hbs
index 798f4bae822..0fce8f066f5 100644
--- a/static/templates/topic_edit_form.hbs
+++ b/static/templates/topic_edit_form.hbs
@@ -2,7 +2,7 @@
<form id="topic_edit_form" class="form-horizontal">
<input type="text" value="" class="inline_topic_edit header-v" id="inline_topic_edit"
- autocomplete="off" />
+ autocomplete="off" maxlength="{{ max_topic_length }}" />
<button type="button" class="topic_edit_save small_square_button animated-purple-button"><i class="fa fa-check" aria-hidden="true"></i></button>
<button type="button" class="topic_edit_cancel small_square_button small_square_x"><i class="fa fa-remove" aria-hidden="true"></i></button>
<div class="alert alert-error edit_error" style="display: none"></div>