Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
compose_actions: Hide compose box when navigating to inbox/recent view.
Sayam Samal7f26905fe088
diff --git a/web/src/compose_actions.js b/web/src/compose_actions.jsindex c54b11757d3..986875e0ab8 100644--- a/web/src/compose_actions.js+++ b/web/src/compose_actions.js@@ -336,6 +336,24 @@ export function cancel() {$(document).trigger("compose_canceled.zulip");}+export function on_show_navigation_view() {+ /* This function dictates the behavior of the compose box+ * when navigating to a view, as opposed to a narrow. */++ // Leave the compose box closed if it was already closed.+ if (!compose_state.composing()) {+ return;+ }++ // Leave the compose box open if there is content or if the recipient was edited.+ if (compose_state.has_message_content() || compose_state.is_recipient_edited_manually()) {+ return;+ }++ // Otherwise, close the compose box.+ cancel();+}+export function on_topic_narrow() {if (!compose_state.composing()) {// If our compose box is closed, then justdiff --git a/web/src/views_util.js b/web/src/views_util.jsindex fa3af6581d6..301ac1f9109 100644--- a/web/src/views_util.js+++ b/web/src/views_util.js@@ -1,5 +1,6 @@import $ from "jquery";+import * as compose_actions from "./compose_actions";import * as compose_recipient from "./compose_recipient";import * as dropdown_widget from "./dropdown_widget";import {$t} from "./i18n";@@ -87,6 +88,7 @@ export function show(opts) {compose_recipient.handle_middle_pane_transition();search.clear_search_form();opts.complete_rerender();+ compose_actions.on_show_navigation_view();// Misc.if (opts.is_recent_view) {