static/js/stream_muting: Rename `update_in_home_view` function.

This commit is contained in:
Yashashvi Dave 2019-05-21 14:11:53 +05:30 committed by Tim Abbott
parent 784d02bf60
commit 2a943d3b40
4 changed files with 7 additions and 9 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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);
};