stream_popover: Show clear button if topic input is not disabled.

Previously, if the topic input was disabled when "Move messages"
modal was opened, the clear button was not added to the DOM
which caused the bug where the clear button was not shown even
if the topic input was later enabled because user was allowed to edit
topics in the selected channel.
This commit is contained in:
Vector73
2025-07-07 09:07:03 +00:00
committed by Tim Abbott
parent 3b4f55a7ea
commit 7b60b2edca
2 changed files with 2 additions and 3 deletions

View File

@@ -884,6 +884,7 @@ export async function build_move_topic_to_stream_popover(
set_stream_topic_typeahead();
render_selected_stream();
maybe_show_topic_already_exists_warning();
update_clear_move_topic_button_state();
update_topic_input_placeholder_visibility(topic_input_value);
const selected_propagate_mode = String($("#message_move_select_options").val());
void warn_unsubscribed_participants(selected_propagate_mode);
@@ -989,7 +990,7 @@ export async function build_move_topic_to_stream_popover(
function update_clear_move_topic_button_state(): void {
const $clear_topic_name_button = $("#clear_move_topic_new_topic_name");
const topic_input_value = $("input#move-topic-new-topic-name").val();
if (topic_input_value === "") {
if (topic_input_value === "" || $("input#move-topic-new-topic-name").prop("disabled")) {
$clear_topic_name_button.css("visibility", "hidden");
} else {
$clear_topic_name_button.css("visibility", "visible");

View File

@@ -14,11 +14,9 @@
<span class="move-topic-new-topic-placeholder placeholder">
{{> topic_not_mandatory_placeholder_text empty_string_topic_display_name=empty_string_topic_display_name}}
</span>
{{#unless disable_topic_input}}
<button type="button" id="clear_move_topic_new_topic_name" class="clear_search_button">
<i class="zulip-icon zulip-icon-close"></i>
</button>
{{/unless}}
</div>
</div>
<input name="old_topic_name" type="hidden" value="{{topic_name}}" />