refactor: De-dup code using subs.sub_or_unsub().

This commit is contained in:
Steve Howell 2017-03-04 09:40:46 -08:00 committed by Tim Abbott
parent 67e558f905
commit a4376efd0f
1 changed files with 2 additions and 11 deletions

View File

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