diff --git a/frontend_tests/node_tests/message_store.js b/frontend_tests/node_tests/message_store.js index 1bc79bac03..f8f79266ac 100644 --- a/frontend_tests/node_tests/message_store.js +++ b/frontend_tests/node_tests/message_store.js @@ -62,6 +62,7 @@ people.add_in_realm(cindy); global.people.initialize_current_user(me.user_id); var message_store = require('js/message_store.js'); +message_store.initialize(); (function test_insert_recent_private_message() { message_store.insert_recent_private_message('1', 1001); diff --git a/static/js/message_store.js b/static/js/message_store.js index 59682d271a..99b1dc469f 100644 --- a/static/js/message_store.js +++ b/static/js/message_store.js @@ -176,7 +176,7 @@ exports.add_message_metadata = function (message) { return message; }; -util.execute_early(function () { +exports.initialize = function () { $(document).on('message_id_changed', function (event) { var old_id = event.old_id; var new_id = event.new_id; @@ -204,7 +204,7 @@ util.execute_early(function () { } }); }); -}); +}; return exports; diff --git a/static/js/ui_init.js b/static/js/ui_init.js index 8b00a44b01..f89a354faa 100644 --- a/static/js/ui_init.js +++ b/static/js/ui_init.js @@ -246,6 +246,7 @@ $(function () { people.initialize(); bot_data.initialize(); // Must happen after people.initialize() message_fetch.initialize(); + message_store.initialize(); markdown.initialize(); composebox_typeahead.initialize(); search.initialize();