From d75efa19dbc71ca5081a8784e8f69d3a78726315 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Sat, 18 Mar 2017 10:10:37 -0700 Subject: [PATCH] Add compose_state.has_message_content() shim. --- .eslintrc.json | 1 + static/js/narrow.js | 4 ++-- static/js/shim.js | 3 +++ static/js/typing.js | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 24f53a7d9a..eaeead79ae 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -35,6 +35,7 @@ "typing": false, "compose": false, "compose_actions": false, + "compose_state": false, "compose_fade": false, "modals": false, "subs": false, diff --git a/static/js/narrow.js b/static/js/narrow.js index b9f7e2c531..272f283029 100644 --- a/static/js/narrow.js +++ b/static/js/narrow.js @@ -191,7 +191,7 @@ exports.activate = function (raw_operators, opts) { trigger: opts ? opts.trigger : undefined, previous_id: current_msg_list.selected_id()}); - var had_message_content = compose.has_message_content(); + var had_message_content = compose_state.has_message_content(); if (!had_message_content) { compose_actions.cancel(); @@ -453,7 +453,7 @@ exports.deactivate = function () { return; } - if (!compose.has_message_content()) { + if (!compose_state.has_message_content()) { compose_actions.cancel(); } diff --git a/static/js/shim.js b/static/js/shim.js index ed3ffb5ebc..e9e76dd40e 100644 --- a/static/js/shim.js +++ b/static/js/shim.js @@ -12,3 +12,6 @@ narrow_state.set_compose_defaults = narrow.set_compose_defaults; var compose_actions = {}; compose_actions.start = compose.start; compose_actions.cancel = compose.cancel; + +var compose_state = {}; +compose_state.has_message_content = compose.has_message_content; diff --git a/static/js/typing.js b/static/js/typing.js index fcae1c0df9..5ae034de60 100644 --- a/static/js/typing.js +++ b/static/js/typing.js @@ -36,7 +36,7 @@ function send_typing_notification_ajax(recipients, operation) { function check_and_send(operation) { var compose_recipient = compose.recipient(); - var compose_nonempty = compose.has_message_content(); + var compose_nonempty = compose_state.has_message_content(); // If we currently have an active typing notification out, and we // want to send a stop notice, or the compose recipient changed