[Patchew-devel] [PATCH] maintainer: update watched list on reviewed and merged events

Paolo Bonzini posted 1 patch 7 months, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/patchew-ci tags/patchew/20220222102126.166482-2-pbonzini@redhat.com
mods/maintainer.py | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
[Patchew-devel] [PATCH] maintainer: update watched list on reviewed and merged events
Posted by Paolo Bonzini 7 months, 1 week ago
---
 mods/maintainer.py | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/mods/maintainer.py b/mods/maintainer.py
index e74b559..8e05a9c 100644
--- a/mods/maintainer.py
+++ b/mods/maintainer.py
@@ -27,6 +27,8 @@ class MaintainerModule(PatchewModule):
 
     def __init__(self):
         register_handler("ResultUpdate", self.on_result_update)
+        register_handler("SeriesMerged", self.on_series_merged)
+        register_handler("SeriesReviewed", self.on_series_reviewed)
         declare_event(
             "MessageQueued",
             message="Message added",
@@ -75,6 +77,21 @@ class MaintainerModule(PatchewModule):
             # maintainers so redo the watched queue
             self._update_watch_queue(obj)
 
+    def on_series_reviewed(self, evt, series):
+        # Handle changes to "is:reviewed"
+        self._update_watch_queue(obj)
+
+    def on_series_merged(self, evt, project, series):
+        # This is a bit of a hack for now.  We probably should hide merged
+        # series more aggressively, but I am not sure how to handle that
+        # efficiently in the database.
+        query = QueuedSeries.objects.filter(
+            message=series, name__in=['accept', 'reject']
+        )
+        self._drop_all_from_queue(query)
+        # Handle changes to "is:merged"
+        self._update_watch_queue(obj)
+
     def _update_review_state(self, request, message_id, accept):
         if not request.user.is_authenticated:
             return HttpResponseForbidden()
-- 
2.34.1

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