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; return;
} }
var sub = stream_data.get_sub(stream_name); 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_sub_unsub').click(function (e) { $('.empty_feed_sub_unsub').click(function (e) {
@ -1316,12 +1311,8 @@ $(function () {
return; return;
} }
var sub = stream_data.get_sub(stream_name); 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_feed_notice').hide();
$('#empty_narrow_message').show(); $('#empty_narrow_message').show();
}); });