mirror of
https://github.com/zulip/zulip.git
synced 2025-11-09 16:37:23 +00:00
recent_topics: Optimize filters_should_hide_topic.
We now get info from other libraries when it is required in the current set of filters.
This commit is contained in:
@@ -164,20 +164,23 @@ function topic_in_search_results(keyword, stream, topic) {
|
|||||||
function filters_should_hide_topic(topic_data) {
|
function filters_should_hide_topic(topic_data) {
|
||||||
const msg = message_store.get(topic_data.last_msg_id);
|
const msg = message_store.get(topic_data.last_msg_id);
|
||||||
|
|
||||||
const unreadCount = unread.unread_topic_counter.get(msg.stream_id, msg.topic);
|
if (filters.has('unread')) {
|
||||||
if (unreadCount === 0 && filters.has('unread')) {
|
const unreadCount = unread.unread_topic_counter.get(msg.stream_id, msg.topic);
|
||||||
return true;
|
if (unreadCount === 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!topic_data.participated && filters.has('participated')) {
|
if (!topic_data.participated && filters.has('participated')) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const topic_muted = !!muting.is_topic_muted(msg.stream_id, msg.topic);
|
if (!filters.has('include_muted')) {
|
||||||
const stream_muted = stream_data.is_muted(msg.stream_id);
|
const topic_muted = !!muting.is_topic_muted(msg.stream_id, msg.topic);
|
||||||
const muted = topic_muted || stream_muted;
|
const stream_muted = stream_data.is_muted(msg.stream_id);
|
||||||
if (muted && !filters.has('include_muted')) {
|
if (topic_muted || stream_muted) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const search_keyword = $("#recent_topics_search").val();
|
const search_keyword = $("#recent_topics_search").val();
|
||||||
|
|||||||
Reference in New Issue
Block a user