Add the ability to narrow to starred messages with `is:starred`.

(imported from commit f1eb552ddd90a1822fa988b60dc13f88f04cfc79)
This commit is contained in:
Jessica McKellar 2013-03-27 13:29:12 -04:00
parent 3d683a93bf
commit 07967e7257
2 changed files with 11 additions and 1 deletions

View File

@ -84,8 +84,11 @@ exports.describe = function (operators) {
var operand = elem[1];
switch (elem[0]) {
case 'is':
if (operand === 'private-message')
if (operand === 'private-message') {
return 'Narrow to all private messages';
} else if (operand === 'starred') {
return 'Narrow to starred messages';
}
break;
case 'stream':
@ -213,7 +216,12 @@ function build_filter(operators_mixed_case) {
if (operand === 'private-message') {
if (message.type !== 'private')
return false;
} else if (operand === 'starred') {
if (!message.starred) {
return false;
}
}
break;
case 'in':

View File

@ -542,6 +542,8 @@ class NarrowBuilder(object):
if operand == 'private-message':
return (Q(message__recipient__type=Recipient.PERSONAL) |
Q(message__recipient__type=Recipient.HUDDLE))
elif operand == 'starred':
return Q(flags=UserMessage.flags.starred)
raise BadNarrowOperator("unknown 'is' operand " + operand)
def by_stream(self, operand):