mirror of https://github.com/zulip/zulip.git
Avoid some server fetches for sender:foo queries.
If we find unread messages for a sender, we will try to render locally narrow for sender searches. Note that our current implementation brute forces through all the unread ids. We can improve this, although it's not really a bottleneck until we also support buckets for general filtering.
This commit is contained in:
parent
6ca145b2ed
commit
0c9cf12933
|
@ -71,7 +71,7 @@ function candidate_ids() {
|
|||
assert.equal(unread_ids, undefined);
|
||||
|
||||
terms = [
|
||||
{operator: 'sender', operand: 'me@example.com'},
|
||||
{operator: 'bogus_operator', operand: 'me@example.com'},
|
||||
];
|
||||
set_filter(terms);
|
||||
unread_ids = candidate_ids();
|
||||
|
@ -129,6 +129,17 @@ function candidate_ids() {
|
|||
unread_ids = candidate_ids();
|
||||
assert.deepEqual(unread_ids, [stream_msg.id]);
|
||||
|
||||
terms = [
|
||||
{operator: 'sender', operand: 'me@example.com'},
|
||||
];
|
||||
set_filter(terms);
|
||||
// note that our candidate ids are just "all" ids now
|
||||
unread_ids = candidate_ids();
|
||||
assert.deepEqual(unread_ids, [stream_msg.id]);
|
||||
|
||||
// this actually does filtering
|
||||
assert_unread_info({flavor: 'not_found'});
|
||||
|
||||
terms = [
|
||||
{operator: 'pm-with', operand: 'alice@example.com'},
|
||||
];
|
||||
|
|
|
@ -256,6 +256,11 @@ exports._possible_unread_message_ids = function () {
|
|||
return unread.get_msg_ids_for_starred();
|
||||
}
|
||||
|
||||
if (current_filter.can_bucket_by('sender')) {
|
||||
// TODO: see #9352 to make this more efficient
|
||||
return unread.get_all_msg_ids();
|
||||
}
|
||||
|
||||
return;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue