subs: Use single jquery-handlers for multiple events.

Rather than defining two different jquery event-handlers for two different
events, we can use a single jquery handler as the function is the same for
both handlers.
This commit is contained in:
Pragati Agrawal 2020-02-04 16:39:57 +05:30 committed by Tim Abbott
parent 84fd0b0974
commit 16abd7ec96
2 changed files with 2 additions and 11 deletions

View File

@ -241,10 +241,7 @@ exports.update_rendered_message_groups = function (message_groups, get_element)
};
exports.initialize = function () {
$(document).on('peer_subscribe.zulip', function () {
exports.update_faded_users();
});
$(document).on('peer_unsubscribe.zulip', function () {
$(document).on('peer_subscribe.zulip peer_unsubscribe.zulip', function () {
exports.update_faded_users();
});
};

View File

@ -650,16 +650,10 @@ exports.initialize = function () {
}
});
$(document).on('peer_subscribe.zulip', function (e, data) {
$(document).on('peer_subscribe.zulip peer_unsubscribe.zulip', function (e, data) {
const sub = stream_data.get_sub(data.stream_name);
subs.rerender_subscriptions_settings(sub);
});
$(document).on('peer_unsubscribe.zulip', function (e, data) {
const sub = stream_data.get_sub(data.stream_name);
subs.rerender_subscriptions_settings(sub);
});
};
window.stream_edit = exports;