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_actions: Include message type in opts for `fill_in_opts_from_current_narrowed_view`.

evykassirer85c5fe635eb1
diff --git a/web/src/compose_actions.js b/web/src/compose_actions.js
index 489790a752b..1274aec669a 100644
--- a/web/src/compose_actions.js
+++ b/web/src/compose_actions.js
@@ -155,9 +155,8 @@ export function maybe_scroll_up_selected_message(opts) {
}
}
-export function fill_in_opts_from_current_narrowed_view(msg_type, opts) {
+export function fill_in_opts_from_current_narrowed_view(opts) {
return {
- message_type: msg_type,
stream_id: undefined,
topic: "",
private_message_recipient: "",
@@ -207,7 +206,7 @@ export function start(opts) {
compose_banner.clear_message_sent_banners();
expand_compose_box();
- opts = fill_in_opts_from_current_narrowed_view(opts.message_type, opts);
+ opts = fill_in_opts_from_current_narrowed_view(opts);
const is_clear_topic_button_triggered = opts.trigger === "clear topic button";
// If we are invoked by a compose hotkey (c or x) or new topic
@@ -431,7 +430,10 @@ export function on_narrow(opts) {
}
if (narrow_state.narrowed_by_pm_reply()) {
- opts = fill_in_opts_from_current_narrowed_view("private", opts);
+ opts = fill_in_opts_from_current_narrowed_view({
+ ...opts,
+ message_type: "private",
+ });
// Do not open compose box if an invalid recipient is present.
if (!opts.private_message_recipient) {
if (compose_state.composing()) {
diff --git a/web/src/compose_reply.js b/web/src/compose_reply.js
index 576e5a84f8e..c7cecc16e9a 100644
--- a/web/src/compose_reply.js
+++ b/web/src/compose_reply.js
@@ -86,10 +86,10 @@ export function respond_to_message(opts) {
msg_type = "private";
}
- const new_opts = compose_actions.fill_in_opts_from_current_narrowed_view(
- msg_type,
- opts,
- );
+ const new_opts = compose_actions.fill_in_opts_from_current_narrowed_view({
+ ...opts,
+ message_type: msg_type,
+ });
compose_actions.start(new_opts);
return;
}