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

This commit updates the inline topic edit form to always show
the empty string topic placeholder when `mandatory_topics = false`.

It also improves the styling to make it italics.
This commit is contained in:
Prakhar Pratyush
2025-02-14 13:26:06 +05:30
committed by Tim Abbott
parent 2416fec468
commit 9a72a4df03
2 changed files with 5 additions and 6 deletions

View File

@@ -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,

View File

@@ -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>