Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
compose: Refactor code to combine 2 same if condition blocks into one.
N-Shar-maa7719184ad4b
diff --git a/web/src/compose_actions.ts b/web/src/compose_actions.tsindex 0f514058a98..84268be49ab 100644--- a/web/src/compose_actions.ts+++ b/web/src/compose_actions.ts@@ -302,11 +302,12 @@ export function start(raw_opts: ComposeActionsStartOpts): void {opts.private_message_recipient.replaceAll(/,\s*/g, ", "),);- // If the user opens the compose box, types some text, and then clicks on a- // different stream/topic, we want to keep the text in the compose boxif (opts.content !== undefined) {compose_ui.insert_and_scroll_into_view(opts.content, $("textarea#compose-textarea"), true);$(".compose_control_button_container:has(.add-poll)").addClass("disabled-on-hover");+ // If we were provided with message content, we might need to+ // display that it's too long.+ compose_validate.check_overflow_text();}compose_state.set_message_type(opts.message_type);@@ -318,12 +319,6 @@ export function start(raw_opts: ComposeActionsStartOpts): void {$("textarea#compose-textarea").data("draft-id", opts.draft_id);}- if (opts.content !== undefined) {- // If we were provided with message content, we might need to- // display that it's too long.- compose_validate.check_overflow_text();- }-const $clear_topic_button = $("#recipient_box_clear_topic_button");if (is_clear_topic_button_triggered || opts.topic.length === 0) {$clear_topic_button.hide();