Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
refactor: Call compose_fade without triggers.
Steve Howellb965766f876a
diff --git a/frontend_tests/node_tests/dispatch.js b/frontend_tests/node_tests/dispatch.jsindex 87ef5412e1c..31ee33cdb54 100644--- a/frontend_tests/node_tests/dispatch.js+++ b/frontend_tests/node_tests/dispatch.js@@ -646,6 +646,9 @@ with_overrides(function (override) {});});+ const compose_fade_stub = global.make_stub();+ override('compose_fade.update_faded_users', compose_fade_stub.f);+event = event_fixtures.subscription__peer_add;global.with_stub(function (stub) {override('stream_data.add_subscriber', stub.f);@@ -654,6 +657,7 @@ with_overrides(function (override) {assert_same(args.sub, event.subscriptions[0]);assert_same(args.user_id, 555);});+ assert.equal(compose_fade_stub.num_calls, 1);event = event_fixtures.subscription__peer_remove;global.with_stub(function (stub) {@@ -663,6 +667,7 @@ with_overrides(function (override) {assert_same(args.sub, event.subscriptions[0]);assert_same(args.user_id, 555);});+ assert.equal(compose_fade_stub.num_calls, 2);event = event_fixtures.subscription__remove;let stream_id_looked_up;diff --git a/frontend_tests/node_tests/ui_init.js b/frontend_tests/node_tests/ui_init.jsindex f457b76bc14..e5023379442 100644--- a/frontend_tests/node_tests/ui_init.js+++ b/frontend_tests/node_tests/ui_init.js@@ -108,7 +108,6 @@ zrequire('tutorial');zrequire('notifications');zrequire('pointer');zrequire('pm_conversations');-zrequire('compose_fade');zrequire('pm_list');zrequire('list_cursor');zrequire('keydown_util');diff --git a/frontend_tests/zjsunit/index.js b/frontend_tests/zjsunit/index.jsindex 0fcd574acce..0bda67f2416 100644--- a/frontend_tests/zjsunit/index.js+++ b/frontend_tests/zjsunit/index.js@@ -44,6 +44,7 @@ global.to_$ = () => window;// Set up stub helpers.const stub = require('./stub.js');+global.make_stub = stub.make_stub;global.with_stub = stub.with_stub;// Set up fake jQuerydiff --git a/static/js/compose_fade.js b/static/js/compose_fade.jsindex 0bda3ce7bae..a5268747029 100644--- a/static/js/compose_fade.js+++ b/static/js/compose_fade.js@@ -239,11 +239,4 @@ exports.update_rendered_message_groups = function (message_groups, get_element)}};-exports.initialize = function () {- $(document).on('peer_subscribe.zulip peer_unsubscribe.zulip', function () {- exports.update_faded_users();- });-};--window.compose_fade = exports;diff --git a/static/js/server_events_dispatch.js b/static/js/server_events_dispatch.jsindex 0499b1c12e3..14e64fece0d 100644--- a/static/js/server_events_dispatch.js+++ b/static/js/server_events_dispatch.js@@ -335,6 +335,7 @@ exports.dispatch_normal_event = function dispatch_normal_event(event) {blueslip.warn('Cannot process peer_add event');}}+ compose_fade.update_faded_users();} else if (event.op === 'peer_remove') {for (const sub of event.subscriptions) {if (stream_data.remove_subscriber(sub, event.user_id)) {@@ -343,6 +344,7 @@ exports.dispatch_normal_event = function dispatch_normal_event(event) {blueslip.warn('Cannot process peer_remove event.');}}+ compose_fade.update_faded_users();} else if (event.op === 'remove') {for (const rec of event.subscriptions) {const sub = stream_data.get_sub_by_id(rec.stream_id);diff --git a/static/js/ui_init.js b/static/js/ui_init.jsindex e07e94f5bf2..c40a723ff8b 100644--- a/static/js/ui_init.js+++ b/static/js/ui_init.js@@ -475,7 +475,6 @@ exports.initialize_everything = function () {presence.initialize(presence_params);activity.initialize();emoji_picker.initialize();- compose_fade.initialize();pm_list.initialize();topic_list.initialize();topic_zoom.initialize();