[Patchew-devel] [PATCH] maintainer: also remove patches from watched queue on events

Paolo Bonzini posted 1 patch 2 months, 3 weeks ago
mods/maintainer.py | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
[Patchew-devel] [PATCH] maintainer: also remove patches from watched queue on events
Posted by Paolo Bonzini 2 months, 3 weeks ago
---
 mods/maintainer.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/mods/maintainer.py b/mods/maintainer.py
index ec49335..e74b559 100644
--- a/mods/maintainer.py
+++ b/mods/maintainer.py
@@ -48,19 +48,24 @@ class MaintainerModule(PatchewModule):
         if created:
             emit_event("MessageQueued", user=user, message=m, queue=q)
 
+    def _drop_all_from_queue(self, query):
+        for q in query:
+            emit_event("MessageDropping", user=q.user, message=q.message, queue=q)
+        query.delete()
+
     def _drop_from_queue(self, user, m, queue):
         query = QueuedSeries.objects.filter(
             user=user, message=m, name=queue
         )
-        for q in query:
-            emit_event("MessageDropping", user=user, message=q.message, queue=q)
-        query.delete()
+        self._drop_all_from_queue(query)
 
     def _update_watch_queue(self, series):
         se = SearchEngine()
         for wq in WatchedQuery.objects.all():
             if se.query_test_message(wq.query, series):
                 self._add_to_queue(wq.user, series, "watched")
+            else:
+                self._drop_from_queue(wq.user, series, "watched")
 
     def on_result_update(self, evt, obj, old_status, result):
         if not isinstance(obj, Message):
-- 
2.34.1

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