narrow: Don't advertise streams:public in is:starred.

We fix this by adding a more expressive data function, with tests, for
whether a filter is on UserMessage data, which would mean that
streams:public could never add additional matches.
This commit is contained in:
Tim Abbott
2020-04-08 11:25:18 -07:00
parent 218be002f1
commit 655993bf0f
3 changed files with 30 additions and 1 deletions

View File

@@ -446,6 +446,15 @@ Filter.prototype = {
return this.has_operator("stream") || this.has_operator("streams");
},
is_personal_filter: function () {
// Whether the filter filters for user-specific data in the
// UserMessage table, such as stars or mentions.
//
// Such filters should not advertise "streams:public" as it
// will never add additional results.
return this.has_operand("is", "mentioned") || this.has_operand("is", "starred");
},
can_apply_locally: function () {
if (this.is_search()) {
// The semantics for matching keywords are implemented