mirror of https://github.com/zulip/zulip.git
Extract stream_data.is_active().
This commit is contained in:
parent
ecbd77d8a5
commit
c799ac3126
|
@ -16,6 +16,9 @@ exports.clear_subscriptions = function () {
|
|||
exports.recent_subjects = new Dict({fold_case: true});
|
||||
exports.clear_subscriptions();
|
||||
|
||||
exports.is_active = function (stream_name) {
|
||||
return exports.recent_subjects.has(stream_name);
|
||||
};
|
||||
|
||||
exports.add_sub = function (stream_name, sub) {
|
||||
if (!_.has(sub, 'subscribers')) {
|
||||
|
|
|
@ -78,7 +78,7 @@ exports.build_stream_list = function () {
|
|||
function add_sidebar_li(stream) {
|
||||
var li = $(stream_data.get_sub(stream).sidebar_li);
|
||||
if (sort_recent) {
|
||||
if (stream_data.recent_subjects.has(stream)) {
|
||||
if (stream_data.is_active(stream)) {
|
||||
li.removeClass('inactive_stream');
|
||||
} else {
|
||||
li.addClass('inactive_stream');
|
||||
|
@ -98,9 +98,9 @@ exports.build_stream_list = function () {
|
|||
|
||||
unpinned_streams.sort(function (a, b) {
|
||||
if (sort_recent) {
|
||||
if (stream_data.recent_subjects.has(b) && ! stream_data.recent_subjects.has(a)) {
|
||||
if (stream_data.is_active(b) && ! stream_data.is_active(a)) {
|
||||
return 1;
|
||||
} else if (! stream_data.recent_subjects.has(b) && stream_data.recent_subjects.has(a)) {
|
||||
} else if (! stream_data.is_active(b) && stream_data.is_active(a)) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ exports.build_stream_list = function () {
|
|||
_.each(pinned_streams, function (stream) {
|
||||
var li = $(stream_data.get_sub(stream).sidebar_li);
|
||||
if (sort_recent) {
|
||||
if (! stream_data.recent_subjects.has(stream)) {
|
||||
if (! stream_data.is_active(stream)) {
|
||||
li.addClass('inactive_stream');
|
||||
} else {
|
||||
li.removeClass('inactive_stream');
|
||||
|
|
Loading…
Reference in New Issue