From 6c6a005920da115878bc3f108e5573eefe141683 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Tue, 12 Mar 2013 15:53:54 -0400 Subject: [PATCH] Update recipient on renarrow when compose box is open but empty. (imported from commit ff50b3b38833e7467ca77714acb1d81c22aeed0c) --- zephyr/static/js/compose.js | 16 ++++++++++++++++ zephyr/static/js/narrow.js | 1 + 2 files changed, 17 insertions(+) diff --git a/zephyr/static/js/compose.js b/zephyr/static/js/compose.js index 24a70d0b3d..dd2787474e 100644 --- a/zephyr/static/js/compose.js +++ b/zephyr/static/js/compose.js @@ -121,6 +121,22 @@ exports.update_faded_messages = function () { fade_around(faded_to); }; +exports.update_recipient_on_narrow = function() { + if (!compose.composing()) { + return; + } + if (compose.message_content() !== "") { + return; + } + var compose_opts = {}; + narrow.set_compose_defaults(compose_opts); + if (compose_opts.stream) { + compose.start("stream"); + } else { + compose.start("private"); + } +}; + exports.start = function (msg_type, opts) { if (reload.is_in_progress()) { return; diff --git a/zephyr/static/js/narrow.js b/zephyr/static/js/narrow.js index fc52522b69..8a329714a5 100644 --- a/zephyr/static/js/narrow.js +++ b/zephyr/static/js/narrow.js @@ -339,6 +339,7 @@ exports.activate = function (operators, opts) { hashchange.save_narrow(operators); $('#search_query').val(unparse(operators)); search.update_button_visibility(); + compose.update_recipient_on_narrow(); compose.update_faded_messages(); $("ul.filters li").removeClass('active-filter');