mirror of https://github.com/zulip/zulip.git
refactor: De-dup code using subs.sub_or_unsub().
This commit is contained in:
parent
67e558f905
commit
a4376efd0f
|
@ -1299,12 +1299,7 @@ $(function () {
|
|||
return;
|
||||
}
|
||||
var sub = stream_data.get_sub(stream_name);
|
||||
|
||||
if (sub.subscribed) {
|
||||
ajaxUnsubscribe(stream_name);
|
||||
} else {
|
||||
ajaxSubscribe(stream_name);
|
||||
}
|
||||
exports.sub_or_unsub(sub);
|
||||
});
|
||||
|
||||
$('.empty_feed_sub_unsub').click(function (e) {
|
||||
|
@ -1316,12 +1311,8 @@ $(function () {
|
|||
return;
|
||||
}
|
||||
var sub = stream_data.get_sub(stream_name);
|
||||
exports.sub_or_unsub(sub);
|
||||
|
||||
if (sub.subscribed) {
|
||||
ajaxUnsubscribe(stream_name);
|
||||
} else {
|
||||
ajaxSubscribe(stream_name);
|
||||
}
|
||||
$('.empty_feed_notice').hide();
|
||||
$('#empty_narrow_message').show();
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue