From 35d38d62f33d9e2012734ef40b476b621b22ecb1 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Sat, 18 Mar 2017 08:59:32 -0700 Subject: [PATCH] Add shim.js w/narrow_state global. --- .eslintrc.json | 1 + static/js/compose.js | 2 +- static/js/shim.js | 10 ++++++++++ zproject/settings.py | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 static/js/shim.js diff --git a/.eslintrc.json b/.eslintrc.json index 2c50b93462..01e1d5e4bc 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -71,6 +71,7 @@ "stream_list": false, "stream_popover": false, "narrow": false, + "narrow_state": false, "admin": false, "stream_data": false, "muting": false, diff --git a/static/js/compose.js b/static/js/compose.js index 28431e7914..7b99ef3b20 100644 --- a/static/js/compose.js +++ b/static/js/compose.js @@ -195,7 +195,7 @@ function fill_in_opts_from_current_narrowed_view(msg_type, opts) { }; // Set default parameters based on the current narrowed view. - narrow.set_compose_defaults(default_opts); + narrow_state.set_compose_defaults(default_opts); opts = _.extend(default_opts, opts); return opts; } diff --git a/static/js/shim.js b/static/js/shim.js new file mode 100644 index 0000000000..02bb6e7646 --- /dev/null +++ b/static/js/shim.js @@ -0,0 +1,10 @@ +/* + +This module has shims to help us break circular dependencies. +We eventually want to to move the actual implementations into +new modules. When we do this, you may need to fix node tests +that still refer to the old name. +*/ + +var narrow_state = {}; // global, should be made into module +narrow_state.set_compose_defaults = narrow.set_compose_defaults; diff --git a/zproject/settings.py b/zproject/settings.py index 931b09ccac..3098698609 100644 --- a/zproject/settings.py +++ b/zproject/settings.py @@ -893,6 +893,7 @@ JS_SPECS = { 'js/bot_data.js', 'js/reactions.js', 'js/typing.js', + 'js/shim.js', # JS bundled by webpack is also included here if PIPELINE_ENABLED setting is true ], 'output_filename': 'min/app.js'