mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
Change argument type for stream_data.is_active().
The function now takes a "sub" object instead of a stream name.
This commit is contained in:
@@ -165,8 +165,8 @@ function clear_filters() {
|
||||
global.stream_data.add_sub('cars', carSub);
|
||||
|
||||
|
||||
global.stream_data.is_active = function (stream_name) {
|
||||
return stream_name !== 'cars';
|
||||
global.stream_data.is_active = function (sub) {
|
||||
return sub.name !== 'cars';
|
||||
};
|
||||
|
||||
stream_list.build_stream_list();
|
||||
|
||||
@@ -32,8 +32,8 @@ stream_data.create_streams([
|
||||
{name: 'Linux', subscribed: true, color: 'red', stream_id: 2},
|
||||
]);
|
||||
|
||||
global.stream_data.is_active = function (stream_name) {
|
||||
return stream_name !== 'dead';
|
||||
global.stream_data.is_active = function (sub) {
|
||||
return sub.name !== 'dead';
|
||||
};
|
||||
|
||||
test_streams = typeahead_helper.sort_streams(test_streams, 'd');
|
||||
|
||||
@@ -18,8 +18,8 @@ exports.clear_subscriptions = function () {
|
||||
|
||||
exports.clear_subscriptions();
|
||||
|
||||
exports.is_active = function (stream_name) {
|
||||
return recent_topics.has(stream_name);
|
||||
exports.is_active = function (sub) {
|
||||
return recent_topics.has(sub.name);
|
||||
};
|
||||
|
||||
exports.rename_sub = function (sub, new_name) {
|
||||
|
||||
@@ -219,7 +219,7 @@ function build_stream_sidebar_row(sub) {
|
||||
var stream_name = sub.name;
|
||||
|
||||
self.update_whether_active = function () {
|
||||
if (stream_data.is_active(stream_name)) {
|
||||
if (stream_data.is_active(sub)) {
|
||||
list_item.removeClass('inactive_stream');
|
||||
} else {
|
||||
list_item.addClass('inactive_stream');
|
||||
|
||||
@@ -43,8 +43,8 @@ exports.sort_groups = function (search_term) {
|
||||
|
||||
streams = filter_streams_by_search(streams, search_term);
|
||||
|
||||
function is_normal(stream) {
|
||||
return stream_data.is_active(stream);
|
||||
function is_normal(sub) {
|
||||
return stream_data.is_active(sub);
|
||||
}
|
||||
|
||||
var pinned_streams = [];
|
||||
@@ -52,10 +52,11 @@ exports.sort_groups = function (search_term) {
|
||||
var dormant_streams = [];
|
||||
|
||||
_.each(streams, function (stream) {
|
||||
var pinned = stream_data.get_sub(stream).pin_to_top;
|
||||
var sub = stream_data.get_sub(stream);
|
||||
var pinned = sub.pin_to_top;
|
||||
if (pinned) {
|
||||
pinned_streams.push(stream);
|
||||
} else if (is_normal(stream)) {
|
||||
} else if (is_normal(sub)) {
|
||||
normal_streams.push(stream);
|
||||
} else {
|
||||
dormant_streams.push(stream);
|
||||
|
||||
@@ -204,13 +204,13 @@ exports.sort_emojis = function (matches, query) {
|
||||
};
|
||||
|
||||
// Gives stream a score from 0 to 3 based on its activity
|
||||
function activity_score(stream) {
|
||||
function activity_score(sub) {
|
||||
var stream_score = 0;
|
||||
if (stream.pin_to_top) {
|
||||
if (sub.pin_to_top) {
|
||||
stream_score += 2;
|
||||
}
|
||||
// Note: A pinned stream may accumulate a 3rd point if it is active
|
||||
if (stream_data.is_active(stream.name)) {
|
||||
if (stream_data.is_active(sub)) {
|
||||
stream_score += 1;
|
||||
}
|
||||
return stream_score;
|
||||
|
||||
Reference in New Issue
Block a user