diff --git a/frontend_tests/node_tests/stream_events.js b/frontend_tests/node_tests/stream_events.js index befce9acb8..a2c7336a58 100644 --- a/frontend_tests/node_tests/stream_events.js +++ b/frontend_tests/node_tests/stream_events.js @@ -62,8 +62,8 @@ run_test('update_property', () => { // Test in home view with_overrides(function (override) { global.with_stub(function (stub) { - override('stream_muting.update_in_home_view', stub.f); - stream_events.update_property(1, 'in_home_view', true); + override('stream_muting.update_is_muted', stub.f); + stream_events.update_property(1, 'in_home_view', false); var args = stub.get_args('sub', 'val'); assert.equal(args.sub.stream_id, 1); assert.equal(args.val, true); diff --git a/static/js/stream_events.js b/static/js/stream_events.js index 85f0244745..d00808a0a0 100644 --- a/static/js/stream_events.js +++ b/static/js/stream_events.js @@ -51,7 +51,7 @@ exports.update_property = function (stream_id, property, value, other_values) { stream_color.update_stream_color(sub, value, {update_historical: true}); break; case 'in_home_view': - stream_muting.update_in_home_view(sub, value); + stream_muting.update_is_muted(sub, !value); break; case 'desktop_notifications': update_stream_desktop_notifications(sub, value); diff --git a/static/js/stream_muting.js b/static/js/stream_muting.js index 0661478a88..95ebbf9087 100644 --- a/static/js/stream_muting.js +++ b/static/js/stream_muting.js @@ -2,10 +2,8 @@ var stream_muting = (function () { var exports = {}; -exports.update_in_home_view = function (sub, value) { - // value is true if we are in home view - // TODO: flip the semantics to be is_muting - sub.is_muted = !value; +exports.update_is_muted = function (sub, value) { + sub.is_muted = value; setTimeout(function () { var msg_offset; @@ -51,7 +49,7 @@ exports.update_in_home_view = function (sub, value) { stream_list.set_in_home_view(sub.stream_id, !sub.is_muted); var not_in_home_view_checkbox = $(".subscription_settings[data-stream-id='" + sub.stream_id + "'] #sub_setting_not_in_home_view .sub_setting_control"); - not_in_home_view_checkbox.prop('checked', !value); + not_in_home_view_checkbox.prop('checked', value); }; return exports; diff --git a/static/js/subs.js b/static/js/subs.js index 69017c2d7a..c9baf74435 100644 --- a/static/js/subs.js +++ b/static/js/subs.js @@ -96,7 +96,7 @@ exports.active_stream = function () { }; exports.toggle_home = function (sub) { - stream_muting.update_in_home_view(sub, sub.is_muted); + stream_muting.update_is_muted(sub, !sub.is_muted); stream_edit.set_stream_property(sub, 'is_muted', sub.is_muted); };