Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

compose_recipient: Simplify update_compose_for_message_type.

Tim Abbottd5422fe7c8ce
diff --git a/web/src/compose_actions.js b/web/src/compose_actions.js
index badf4446b23..4d064c27df7 100644
--- a/web/src/compose_actions.js
+++ b/web/src/compose_actions.js
@@ -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");
diff --git a/web/src/compose_recipient.js b/web/src/compose_recipient.js
index a867b72c3f9..ce37e1c4522 100644
--- a/web/src/compose_recipient.js
+++ b/web/src/compose_recipient.js
@@ -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");