compose_recipient: Simplify update_compose_for_message_type.

At least one of the callers already passes the field in the opts
parameter, and the other can easily include it in the object.

(It might have it already, but that'll be easily checked while
converting compose_actions).
This commit is contained in:
Tim Abbott 2024-04-03 12:33:10 -07:00
parent 80a3cadf4e
commit d5422fe7c8
2 changed files with 4 additions and 4 deletions

View File

@ -59,7 +59,7 @@ function hide_box() {
}
function show_compose_box(message_type, opts) {
compose_recipient.update_compose_for_message_type(message_type, opts);
compose_recipient.update_compose_for_message_type({...opts, message_type});
$("#compose").css({visibility: "visible"});
// When changing this, edit the 42px in _maybe_autoscroll
$(".new_message_textarea").css("min-height", "3em");

View File

@ -146,7 +146,7 @@ function switch_message_type(message_type) {
topic: compose_state.topic(),
private_message_recipient: compose_state.private_message_recipient(),
};
update_compose_for_message_type(message_type, opts);
update_compose_for_message_type(opts);
update_placeholder_text();
compose_ui.set_focus(opts);
}
@ -164,8 +164,8 @@ function update_recipient_label(stream_id) {
}
}
export function update_compose_for_message_type(message_type, opts) {
if (message_type === "stream") {
export function update_compose_for_message_type(opts) {
if (opts.message_type === "stream") {
$("#compose-direct-recipient").hide();
$("#compose_recipient_box").show();
$("#stream_toggle").addClass("active");