mirror of
https://github.com/zulip/zulip.git
synced 2025-11-07 15:33:30 +00:00
topic lists: Call narrow.topic() in topic_list.js.
We no longer need stream_list.js to pass in the currently active topic to us; we just call narrow.topic() for it.
This commit is contained in:
@@ -385,11 +385,11 @@ exports._build_private_messages_list = function (active_conversation, max_privat
|
|||||||
return recipients_dom;
|
return recipients_dom;
|
||||||
};
|
};
|
||||||
|
|
||||||
function rebuild_recent_topics(stream, active_topic) {
|
function rebuild_recent_topics(stream) {
|
||||||
// TODO: Call rebuild_recent_topics less, not on every new
|
// TODO: Call rebuild_recent_topics less, not on every new
|
||||||
// message.
|
// message.
|
||||||
var stream_li = get_filter_li('stream', stream);
|
var stream_li = get_filter_li('stream', stream);
|
||||||
topic_list.rebuild(stream_li, stream, active_topic);
|
topic_list.rebuild(stream_li, stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
function rebuild_recent_private_messages(active_conversation) {
|
function rebuild_recent_private_messages(active_conversation) {
|
||||||
@@ -417,14 +417,9 @@ exports.update_streams_sidebar = function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var op_stream = narrow.filter().operands('stream');
|
var op_stream = narrow.filter().operands('stream');
|
||||||
var op_subject = narrow.filter().operands('topic');
|
|
||||||
var subject;
|
|
||||||
if (op_stream.length !== 0) {
|
if (op_stream.length !== 0) {
|
||||||
if (op_subject.length !== 0) {
|
|
||||||
subject = op_subject[0];
|
|
||||||
}
|
|
||||||
if (stream_data.is_subscribed(op_stream[0])) {
|
if (stream_data.is_subscribed(op_stream[0])) {
|
||||||
rebuild_recent_topics(op_stream[0], subject);
|
rebuild_recent_topics(op_stream[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -572,13 +567,10 @@ $(function () {
|
|||||||
if (op_stream.length !== 0 && stream_data.is_subscribed(op_stream[0])) {
|
if (op_stream.length !== 0 && stream_data.is_subscribed(op_stream[0])) {
|
||||||
var stream_li = get_filter_li('stream', op_stream[0]);
|
var stream_li = get_filter_li('stream', op_stream[0]);
|
||||||
var op_subject = event.filter.operands('topic');
|
var op_subject = event.filter.operands('topic');
|
||||||
var subject;
|
if (op_subject.length === 0) {
|
||||||
if (op_subject.length !== 0) {
|
|
||||||
subject = op_subject[0];
|
|
||||||
} else {
|
|
||||||
stream_li.addClass('active-filter');
|
stream_li.addClass('active-filter');
|
||||||
}
|
}
|
||||||
rebuild_recent_topics(op_stream[0], subject);
|
rebuild_recent_topics(op_stream[0]);
|
||||||
unread.process_visible();
|
unread.process_visible();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -120,9 +120,11 @@ exports.build_widget = function (stream, active_topic, max_topics) {
|
|||||||
return self;
|
return self;
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.rebuild = function (stream_li, stream, active_topic) {
|
exports.rebuild = function (stream_li, stream) {
|
||||||
var max_topics = 5;
|
var max_topics = 5;
|
||||||
|
|
||||||
|
var active_topic = narrow.topic();
|
||||||
|
|
||||||
exports.remove_expanded_topics();
|
exports.remove_expanded_topics();
|
||||||
|
|
||||||
var widget = exports.build_widget(stream, active_topic, max_topics);
|
var widget = exports.build_widget(stream, active_topic, max_topics);
|
||||||
|
|||||||
Reference in New Issue
Block a user