[Patchew-devel] [PATCH fixed] search: fix "review", add "watch"

Paolo Bonzini posted 1 patch 14 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/patchew next tags/patchew/20190117104134.15772-1-pbonzini@redhat.com
api/search.py | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)

[Patchew-devel] [PATCH fixed] search: fix "review", add "watch"

Posted by Paolo Bonzini 14 weeks ago
---
 api/search.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/api/search.py b/api/search.py
index e9cf7ec..baf6893 100644
--- a/api/search.py
+++ b/api/search.py
@@ -162,6 +162,7 @@ Syntax:
  - accept:USERNAME or ack:USERNAME - the series was marked as accepted by the user
  - reject:USERNAME or nack:USERNAME - the series was marked as reject by the user
  - review:USERNAME - the series was marked as accepted or rejected by the user
+ - watch:USERNAME - the series is in the user's watched queue
 
 USERNAME can be "me" to identify the current user
 
@@ -267,7 +268,7 @@ Search text keyword in the email message. Example:
             return Q(is_merged=True)
         return None
 
-    def _make_filter_review(self, username, user, **kwargs):
+    def _make_filter_queue(self, username, user, **kwargs):
         if username == "me":
             if not user.is_authenticated:
                 # Django hack to return an always false Q object
@@ -320,13 +321,16 @@ Search text keyword in the email message. Example:
             return self._make_filter_result(term[8:], status=Result.RUNNING)
         elif term.startswith("ack:") or term.startswith("accept:") or term.startswith("accepted:"):
             username = term[term.find(":") + 1:]
-            return self._make_filter_review(username, user, name="accept")
+            return self._make_filter_queue(username, user, name="accept")
         elif term.startswith("nack:") or term.startswith("reject:") or term.startswith("rejected:"):
             username = term[term.find(":") + 1:]
-            return self._make_filter_review(username, user, name="reject")
+            return self._make_filter_queue(username, user, name="reject")
         elif term.startswith("review:") or term.startswith("reviewed:"):
             username = term[term.find(":") + 1:]
-            return self._make_filter_review(username, user, name="accept")
+            return self._make_filter_queue(username, user, name__in=["accept", "reject"])
+        elif term.startswith("watch:") or term.startswith("watched:"):
+            username = term[term.find(":") + 1:]
+            return self._make_filter_queue(username, user, name="watched")
         elif term.startswith("project:"):
             cond = term[term.find(":") + 1:]
             self._projects.add(cond)
-- 
2.20.1

_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://www.redhat.com/mailman/listinfo/patchew-devel