compose: Add trigger for new private message.

This commit adds a new trigger for compose.start that is
"new private message". It will clear the message recipients
whenever compose.start is called with this trigger.

This solves the bug, when a person is in a PM narrow and
clicks the new private message button, it opens the
composebox with the recipients filled out with whoever
you're narrowed to, rather than opening a new, blank PM.

CZO link for the issue
https://chat.zulip.org/#narrow/stream/9-issues/topic/.22New.20private.20message.22.20isn't/near/1222712
This commit is contained in:
Priyam Seth
2021-07-05 15:18:15 +05:30
committed by Tim Abbott
parent 6a04648fd7
commit 985e95041d
3 changed files with 17 additions and 2 deletions

View File

@@ -223,7 +223,11 @@ export function start(msg_type, opts) {
// If we are invoked by a compose hotkey (c or x) or new topic
// button, do not assume that we know what the message's topic or
// PM recipient should be.
if (opts.trigger === "compose_hotkey" || opts.trigger === "new topic button") {
if (
opts.trigger === "compose_hotkey" ||
opts.trigger === "new topic button" ||
opts.trigger === "new private message"
) {
opts.topic = "";
opts.private_message_recipient = "";
}