filter: Extract filter.contains_only_private_messages.

This will be a useful reusable function for determining whether to
display other alerts as well.
This commit is contained in:
Tim Abbott
2019-10-09 14:41:24 -07:00
parent f8928182cf
commit d6c9de6036
3 changed files with 37 additions and 2 deletions

View File

@@ -384,9 +384,16 @@ Filter.prototype = {
can_mark_messages_read: function () {
return !this.has_operator('search');
},
allow_use_first_unread_when_narrowing: function () {
return this.can_mark_messages_read() || this.has_operator('is');
},
contains_only_private_messages: function () {
return this.has_operator("is") && this.operands("is")[0] === "private" ||
this.has_operator("pm-with") || this.has_operator("group-pm-with");
},
can_apply_locally: function () {
if (this.is_search()) {
// The semantics for matching keywords are implemented