compose-actions: Stop compose box load for invalid users with any trigger.

A user could trigger a "pm-with" narrow with an invalid user by moving
back/forward in the session, which would trigger the compose box to
open via a hash change. Updates the check to pass in any "pm-with"
narrow with an invalid user.

Also, if the compose box was active/started in the previous view, but
without any content, then we want to actively cancel/close it in the
invalid user "pm-with" narrow.
This commit is contained in:
Lauryn Menard 2022-11-04 18:58:39 +01:00 committed by Tim Abbott
parent 09c4e2f662
commit 54ad2f5266
1 changed files with 5 additions and 3 deletions

View File

@ -632,9 +632,11 @@ export function on_narrow(opts) {
if (narrow_state.narrowed_by_pm_reply()) {
opts = fill_in_opts_from_current_narrowed_view("private", opts);
// Do not open compose box if triggered by search and invalid recipient
// is present.
if (opts.trigger === "search" && !opts.private_message_recipient) {
// Do not open compose box if an invalid recipient is present.
if (!opts.private_message_recipient) {
if (compose_state.composing()) {
cancel();
}
return;
}
// Do not open compose box if organization has disabled sending