Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
bug: Fix topic field and placeholder behavior.
Vector73628c2fcb0d25
diff --git a/web/src/compose_recipient.ts b/web/src/compose_recipient.tsindex 333e4c60226..c1179f950d1 100644--- a/web/src/compose_recipient.ts+++ b/web/src/compose_recipient.ts@@ -345,15 +345,6 @@ export function update_topic_inputbox_on_topics_policy_change(): void {export function update_topic_displayed_text(topic_name = "", has_topic_focus = false): void {compose_state.topic(topic_name);- // When topics are mandatory, no additional adjustments are needed.- // Also, if the recipient in the compose box is not selected, the- // placeholder will always be "Topic" and never "general chat".- if (!stream_data.can_use_empty_topic(compose_state.stream_id())) {- return;- }- // Otherwise, we have some adjustments to make to display:- // * a placeholder with the default topic name stylized- // * the empty string topic stylizedconst $input = $("input#stream_message_recipient_topic");const is_empty_string_topic = topic_name === "";const recipient_widget_hidden =@@ -366,6 +357,16 @@ export function update_topic_displayed_text(topic_name = "", has_topic_focus = f$topic_not_mandatory_placeholder.removeClass("visible");$topic_not_mandatory_placeholder.hide();+ if (!stream_data.can_use_empty_topic(compose_state.stream_id())) {+ $input.attr("placeholder", $t({defaultMessage: "Topic"}));+ // When topics are mandatory, no additional adjustments are needed.+ // Also, if the recipient in the compose box is not selected, the+ // placeholder will always be "Topic" and never "general chat".+ return;+ }+ // Otherwise, we have some adjustments to make to display:+ // * a placeholder with the default topic name stylized+ // * the empty string topic stylizedfunction update_placeholder_visibility(): void {$topic_not_mandatory_placeholder.toggleClass("visible", $input.val() === "");}