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.

topic_edit: Show "general chat" placeholder when mandatory_topics=false.

Prakhar Pratyush9a72a4df03ba
diff --git a/web/src/message_edit.ts b/web/src/message_edit.ts
index 6c3a6423bfd..6f561661d4c 100644
--- a/web/src/message_edit.ts
+++ b/web/src/message_edit.ts
@@ -899,6 +899,8 @@ export function start_inline_topic_edit($recipient_row: JQuery): void {
const $form = $(
render_topic_edit_form({
max_topic_length: realm.max_topic_length,
+ realm_mandatory_topics: realm.realm_mandatory_topics,
+ empty_string_topic_display_name: util.get_final_topic_display_name(""),
}),
);
message_lists.current.show_edit_topic_on_recipient_row($recipient_row, $form);
@@ -912,10 +914,6 @@ export function start_inline_topic_edit($recipient_row: JQuery): void {
const topic = message.topic;
const $inline_topic_edit_input = $form.find<HTMLInputElement>("input.inline_topic_edit");
$inline_topic_edit_input.val(topic).trigger("select").trigger("focus");
- if (topic === "") {
- const topic_display_name = util.get_final_topic_display_name(topic);
- $inline_topic_edit_input.attr("placeholder", topic_display_name);
- }
const stream_name = stream_data.get_stream_name_from_id(message.stream_id);
composebox_typeahead.initialize_topic_edit_typeahead(
$inline_topic_edit_input,
diff --git a/web/templates/topic_edit_form.hbs b/web/templates/topic_edit_form.hbs
index 7c864952c20..bd307c69512 100644
--- a/web/templates/topic_edit_form.hbs
+++ b/web/templates/topic_edit_form.hbs
@@ -1,8 +1,9 @@
{{! Client-side Handlebars template for rendering the topic edit form. }}
<form id="topic_edit_form">
- <input type="text" value="" class="inline_topic_edit header-v"
- autocomplete="off" maxlength="{{ max_topic_length }}" />
+ <input type="text" value="" autocomplete="off" maxlength="{{ max_topic_length }}"
+ class="inline_topic_edit header-v {{#unless realm_mandatory_topics}}empty-topic-placeholder-display{{/unless}}"
+ {{#unless realm_mandatory_topics}}placeholder="{{empty_string_topic_display_name}}"{{/unless}} />
<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>