From nobody Tue Jan  7 08:31:38 2025
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of redhat.com designates
 170.10.133.124 as permitted sender) client-ip=170.10.133.124;
 envelope-from=patchew-devel-bounces@redhat.com;
 helo=us-smtp-delivery-124.mimecast.com;
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as
 permitted sender)  smtp.mailfrom=patchew-devel-bounces@redhat.com;
	dmarc=pass(p=none dis=none)  header.from=redhat.com
ARC-Seal: i=1; a=rsa-sha256; t=1648204661; cv=none;
	d=zohomail.com; s=zohoarc;
	b=FL1HI6GYnek7RBTuxeuTjN2HI1Vu5ULY9BCGhBVa1cV/8FzmHxzyyoWFHkts7ufSyftf/FWoq2Eb7iJfXSMYh+T8UBE+upB6PAOgwhYDi0a5vYzIhYyDXI4t+VHS3LlYlusifWJ83GI3SobmUpNjaGeNOQzcoZIEySDLo3h4o6c=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1648204661;
 h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=dZDD3pptWX15eO2eIWhCS4qHuIT0d5M/PDvi4VgwJus=;
	b=mVMmrWZvw+N/if3gwxhF4miLmwmCGL+2BE0XwSHTfoxXcmKE3x8ooLIWMw2mDYl0qN1vWL/w66/K26ox6PRaQugG2/LHp88D4zue5JFiCoS5mrbBLYvshdSrsB/41uTd9cR+5T8ZrUxneAo845O23KuFfRkzwL8/++DYLR8ZvdA=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as
 permitted sender)  smtp.mailfrom=patchew-devel-bounces@redhat.com;
	dmarc=pass header.from=<pbonzini@redhat.com> (p=none dis=none)
Return-Path: <patchew-devel-bounces@redhat.com>
Received: from us-smtp-delivery-124.mimecast.com
 (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com
	with SMTPS id 1648204661958507.88418006441793;
 Fri, 25 Mar 2022 03:37:41 -0700 (PDT)
Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com
 [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS
 (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 us-mta-554-s6jhFB2qMQOccymMKVCWLQ-1; Fri, 25 Mar 2022 06:37:37 -0400
Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com
 [10.11.54.8])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 36A86954705;
	Fri, 25 Mar 2022 10:37:37 +0000 (UTC)
Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com
 (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100])
	by smtp.corp.redhat.com (Postfix) with ESMTP id 2EB98C27D91;
	Fri, 25 Mar 2022 10:37:37 +0000 (UTC)
Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com
 (localhost [IPv6:::1])
	by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with
 ESMTP id EFEE5194034F;
	Fri, 25 Mar 2022 10:37:36 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com
 [10.11.54.7])
 by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with
 ESMTP id AEA7C1940341 for <patchew-devel@listman.corp.redhat.com>;
 Fri, 25 Mar 2022 10:37:35 +0000 (UTC)
Received: by smtp.corp.redhat.com (Postfix)
 id A32CB1454557; Fri, 25 Mar 2022 10:37:35 +0000 (UTC)
Received: from avogadro.redhat.com (unknown [10.39.195.65])
 by smtp.corp.redhat.com (Postfix) with ESMTP id 34E2E1454556
 for <patchew-devel@redhat.com>; Fri, 25 Mar 2022 10:37:35 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
	s=mimecast20190719; t=1648204660;
	h=from:from:sender:sender:reply-to:subject:subject:date:date:
	 message-id:message-id:to:to:cc:mime-version:mime-version:
	 content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references:list-id:list-help:
	 list-unsubscribe:list-subscribe:list-post;
	bh=dZDD3pptWX15eO2eIWhCS4qHuIT0d5M/PDvi4VgwJus=;
	b=dYzbqG0SIAcp9De1rwwapfdVJOFsqCOVX8ZADbd8RhXT7+H6UQ3IguZSyE5HhGHm3RlNrE
	qvoPJ+/YEkeVZ9ESMoHhpJCa1Oq7BH7UQvssUQ9K4G6iNsKDB7N4GTyYAcwONSAX2NJ0L+
	sJ7uCj9hvRNJHT4HU8JSSKYiWQ7admw=
X-MC-Unique: s6jhFB2qMQOccymMKVCWLQ-1
X-Original-To: patchew-devel@listman.corp.redhat.com
From: Paolo Bonzini <pbonzini@redhat.com>
To: patchew-devel@redhat.com
Date: Fri, 25 Mar 2022 11:37:30 +0100
Message-Id: <20220325103733.296529-2-pbonzini@redhat.com>
In-Reply-To: <20220325103733.296529-1-pbonzini@redhat.com>
References: <20220325103733.296529-1-pbonzini@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7
Subject: [Patchew-devel] [PATCH 1/4] maintainer: show current watched query
 in watched queue page
X-BeenThere: patchew-devel@redhat.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Patchew development and discussion list <patchew-devel.redhat.com>
List-Unsubscribe: <https://listman.redhat.com/mailman/options/patchew-devel>,
 <mailto:patchew-devel-request@redhat.com?subject=unsubscribe>
List-Archive: <http://listman.redhat.com/archives/patchew-devel/>
List-Post: <mailto:patchew-devel@redhat.com>
List-Help: <mailto:patchew-devel-request@redhat.com?subject=help>
List-Subscribe: <https://listman.redhat.com/mailman/listinfo/patchew-devel>,
 <mailto:patchew-devel-request@redhat.com?subject=subscribe>
Errors-To: patchew-devel-bounces@redhat.com
Sender: "Patchew-devel" <patchew-devel-bounces@redhat.com>
X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8
Authentication-Results: relay.mimecast.com;
	auth=pass smtp.auth=CUSA124A263
 smtp.mailfrom=patchew-devel-bounces@redhat.com
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Content-Transfer-Encoding: quoted-printable
X-ZohoMail-DKIM: pass (identity @redhat.com)
X-ZM-MESSAGEID: 1648204663946100005
Content-Type: text/plain; charset="utf-8"

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 mods/maintainer.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/mods/maintainer.py b/mods/maintainer.py
index 6d05bdb..09d2154 100644
--- a/mods/maintainer.py
+++ b/mods/maintainer.py
@@ -199,11 +199,18 @@ class MaintainerModule(PatchewModule):
=20
     def www_view_queue(self, request, project, name):
         query =3D self.query_queue(request, project, name)
-        search =3D "project:" + project + " queue:" + name
+        if name =3D=3D "watched":
+            # TODO: make the WatchedQuery per-project
+            q =3D WatchedQuery.objects.filter(user=3Drequest.user).first()=
.query
+            se =3D SearchEngine([q], request.user)
+            if not se.project():
+                q =3D "project:" + project + " " + q
+        else:
+            q =3D "project:" + project + " queue:" + name
         return render_series_list_page(
             request,
             query,
-            search=3Dsearch,
+            search=3Dq,
             project=3Dproject,
             title=3D'"' + name + '" queue',
             link_icon=3D"fa fa-download",
--=20
2.35.1


_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/patchew-devel
From nobody Tue Jan  7 08:31:38 2025
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of redhat.com designates
 170.10.129.124 as permitted sender) client-ip=170.10.129.124;
 envelope-from=patchew-devel-bounces@redhat.com;
 helo=us-smtp-delivery-124.mimecast.com;
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as
 permitted sender)  smtp.mailfrom=patchew-devel-bounces@redhat.com;
	dmarc=pass(p=none dis=none)  header.from=redhat.com
ARC-Seal: i=1; a=rsa-sha256; t=1648204662; cv=none;
	d=zohomail.com; s=zohoarc;
	b=DdDIWZWupuNRQqJZV4Do2VzVKs2BlZdayCdfiaTNkty0Xdbs83hev0DHRMJnJfNMqpFxrlVjWXGB8al9zZSlfunHheWd0hwmEiYULybGWNB+74DqlK2J2aKW85vSnRgtAvK9C3VurfDD/521aQxWFzSQB8ebU/80NHn0yDbcMfM=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1648204662;
 h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=f+YoRfCVLpCs3MKlag23LBDdoXjwBVPaRfDImGHDumU=;
	b=ilqrjTMxd+WQdrgMSetEKbp9u9bincTVz4EswFoTmqMxeEsjY3eJTl4YXbMXqKnTcxfm3TCKhtSvapW1LFASTUhjfTIFFZH23Prpo0JGLjrng9ZFIhR3qeIgI2+uZqP/6F4t2DU+2VBVyJKW7JGsN/UOEBhAgd4+ngjR/NPBpmg=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as
 permitted sender)  smtp.mailfrom=patchew-devel-bounces@redhat.com;
	dmarc=pass header.from=<pbonzini@redhat.com> (p=none dis=none)
Return-Path: <patchew-devel-bounces@redhat.com>
Received: from us-smtp-delivery-124.mimecast.com
 (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com
	with SMTPS id 1648204662895266.20896215045775;
 Fri, 25 Mar 2022 03:37:42 -0700 (PDT)
Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com
 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS
 (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 us-mta-421--PcYj50jMN2SRLzWYvMqvw-1; Fri, 25 Mar 2022 06:37:38 -0400
Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com
 [10.11.54.6])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4502C2A59540;
	Fri, 25 Mar 2022 10:37:38 +0000 (UTC)
Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com
 (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100])
	by smtp.corp.redhat.com (Postfix) with ESMTP id 3DA022166B2D;
	Fri, 25 Mar 2022 10:37:38 +0000 (UTC)
Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com
 (localhost [IPv6:::1])
	by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with
 ESMTP id 06931194034F;
	Fri, 25 Mar 2022 10:37:38 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com
 [10.11.54.7])
 by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with
 ESMTP id 797D0194034E for <patchew-devel@listman.corp.redhat.com>;
 Fri, 25 Mar 2022 10:37:36 +0000 (UTC)
Received: by smtp.corp.redhat.com (Postfix)
 id 6D61314583C1; Fri, 25 Mar 2022 10:37:36 +0000 (UTC)
Received: from avogadro.redhat.com (unknown [10.39.195.65])
 by smtp.corp.redhat.com (Postfix) with ESMTP id F12B51454557
 for <patchew-devel@redhat.com>; Fri, 25 Mar 2022 10:37:35 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
	s=mimecast20190719; t=1648204661;
	h=from:from:sender:sender:reply-to:subject:subject:date:date:
	 message-id:message-id:to:to:cc:mime-version:mime-version:
	 content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references:list-id:list-help:
	 list-unsubscribe:list-subscribe:list-post;
	bh=f+YoRfCVLpCs3MKlag23LBDdoXjwBVPaRfDImGHDumU=;
	b=aqfxEPjPWH1wl7H3nxexGSm9VoKOrauK+9FKC3u+JiCbuPomQ/PdWa5jJjnQh3wY4zjYwX
	6Oux5oDr+klANGZrCxLK2t1lNA/D5KHtkcqbwM6c5acF39RoVgDHRy7NMIlVts8jc6xr86
	8RtkK5XQ7dIzsqzmDP9IoKe6und4Rak=
X-MC-Unique: -PcYj50jMN2SRLzWYvMqvw-1
X-Original-To: patchew-devel@listman.corp.redhat.com
From: Paolo Bonzini <pbonzini@redhat.com>
To: patchew-devel@redhat.com
Date: Fri, 25 Mar 2022 11:37:31 +0100
Message-Id: <20220325103733.296529-3-pbonzini@redhat.com>
In-Reply-To: <20220325103733.296529-1-pbonzini@redhat.com>
References: <20220325103733.296529-1-pbonzini@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7
Subject: [Patchew-devel] [PATCH 2/4] maintainer: make
 _add_to_queue/_drop_from_queue take an array of messages
X-BeenThere: patchew-devel@redhat.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Patchew development and discussion list <patchew-devel.redhat.com>
List-Unsubscribe: <https://listman.redhat.com/mailman/options/patchew-devel>,
 <mailto:patchew-devel-request@redhat.com?subject=unsubscribe>
List-Archive: <http://listman.redhat.com/archives/patchew-devel/>
List-Post: <mailto:patchew-devel@redhat.com>
List-Help: <mailto:patchew-devel-request@redhat.com?subject=help>
List-Subscribe: <https://listman.redhat.com/mailman/listinfo/patchew-devel>,
 <mailto:patchew-devel-request@redhat.com?subject=subscribe>
Errors-To: patchew-devel-bounces@redhat.com
Sender: "Patchew-devel" <patchew-devel-bounces@redhat.com>
X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6
Authentication-Results: relay.mimecast.com;
	auth=pass smtp.auth=CUSA124A263
 smtp.mailfrom=patchew-devel-bounces@redhat.com
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Content-Transfer-Encoding: quoted-printable
X-ZohoMail-DKIM: pass (identity @redhat.com)
X-ZM-MESSAGEID: 1648205564665100001
Content-Type: text/plain; charset="utf-8"

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 mods/maintainer.py | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/mods/maintainer.py b/mods/maintainer.py
index 09d2154..f183c90 100644
--- a/mods/maintainer.py
+++ b/mods/maintainer.py
@@ -54,12 +54,13 @@ class MaintainerModule(PatchewModule):
             queue=3D"Queue that message is being removed from",
         )
=20
-    def _add_to_queue(self, user, m, queue):
-        q, created =3D QueuedSeries.objects.get_or_create(
-            user=3Duser, message=3Dm, name=3Dqueue
-        )
-        if created:
-            emit_event("MessageQueued", user=3Duser, message=3Dm, queue=3D=
q)
+    def _add_to_queue(self, user, msgs, queue):
+        for m in msgs:
+            q, created =3D QueuedSeries.objects.get_or_create(
+                user=3Duser, message=3Dm, name=3Dqueue
+            )
+            if created:
+                emit_event("MessageQueued", user=3Duser, message=3Dm, queu=
e=3Dq)
=20
     def _drop_all_from_queue(self, query):
         events =3D [{"user": q.user, "message": q.message, "queue": q} for=
 q in query]
@@ -67,17 +68,17 @@ class MaintainerModule(PatchewModule):
         for ev in events:
             emit_event("MessageDropped", **ev)
=20
-    def _drop_from_queue(self, user, m, queue):
-        query =3D QueuedSeries.objects.filter(user=3Duser, message=3Dm, na=
me=3Dqueue)
+    def _drop_from_queue(self, user, msgs, queue):
+        query =3D QueuedSeries.objects.filter(user=3Duser, message__in=3Dm=
sgs, name=3Dqueue)
         self._drop_all_from_queue(query)
=20
     def _update_watch_queue(self, series):
         for wq in WatchedQuery.objects.all():
             se =3D SearchEngine([wq.query], wq.user)
             if se.query_test_message(series):
-                self._add_to_queue(wq.user, series, "watched")
+                self._add_to_queue(wq.user, [series], "watched")
             else:
-                self._drop_from_queue(wq.user, series, "watched")
+                self._drop_from_queue(wq.user, [series], "watched")
=20
     def on_queue_change(self, evt, user, message, queue):
         # Handle changes to e.g. "-nack:me"
@@ -118,8 +119,8 @@ class MaintainerModule(PatchewModule):
             to_create, to_delete =3D "accept", "reject"
         else:
             to_create, to_delete =3D "reject", "accept"
-        self._drop_from_queue(request.user, msg, to_delete)
-        self._add_to_queue(request.user, msg, to_create)
+        self._drop_from_queue(request.user, [msg], to_delete)
+        self._add_to_queue(request.user, [msg], to_create)
=20
     def _delete_review(self, request, project, message_id):
         msg =3D Message.objects.find_series(message_id, project)
@@ -167,7 +168,7 @@ class MaintainerModule(PatchewModule):
         queue =3D request.POST.get("queue")
         if not queue or re.match(r"[^_a-zA-Z0-9\-]", queue):
             return HttpResponseBadRequest("Invalid queue name")
-        self._add_to_queue(request.user, m, queue)
+        self._add_to_queue(request.user, [m], queue)
=20
     @method_decorator(www_authenticated_op)
     def www_view_drop_from_queue(self, request, queue, project, message_id=
):
--=20
2.35.1


_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/patchew-devel
From nobody Tue Jan  7 08:31:38 2025
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of redhat.com designates
 170.10.133.124 as permitted sender) client-ip=170.10.133.124;
 envelope-from=patchew-devel-bounces@redhat.com;
 helo=us-smtp-delivery-124.mimecast.com;
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as
 permitted sender)  smtp.mailfrom=patchew-devel-bounces@redhat.com;
	dmarc=pass(p=none dis=none)  header.from=redhat.com
ARC-Seal: i=1; a=rsa-sha256; t=1648204669; cv=none;
	d=zohomail.com; s=zohoarc;
	b=nSfF3wqeD/L5jjCKqMLc5HmPddK4w9RK1xGD0G/aV/ruCTxCYXw7pl7wvEnudHv7xCIaB8UIkQr/a2cfUYPs5H2OW1jgLvCsoDvwekqnglxX+XpmzGucUiQps5YM661h+p1Eu4B1WNnO+w9SHe8oQfHOe6aqLF/7WguAZb5YBds=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1648204669;
 h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=fBkbHkgxixl5nD7NilSm28gw+DtO0wYXRR1QUKUx3rA=;
	b=iRBTjcgyb7RdWid2S9jMmeJIVu0v5m9w8OANLWT1B+Na2smNilIByGLLd1Er/ffwO3qBluTnu/InSz25b/VMPf9oXzHZyMom6+h/TMWu9REx2TDw4Nfm1qW/pGey6FoYYroEb8RO1AWxnSC05x/SnhI0/fy8udiwXjC7t8sON0w=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as
 permitted sender)  smtp.mailfrom=patchew-devel-bounces@redhat.com;
	dmarc=pass header.from=<pbonzini@redhat.com> (p=none dis=none)
Return-Path: <patchew-devel-bounces@redhat.com>
Received: from us-smtp-delivery-124.mimecast.com
 (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com
	with SMTPS id 1648204669179320.4160067226021;
 Fri, 25 Mar 2022 03:37:49 -0700 (PDT)
Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com
 [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS
 (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 us-mta-154-qms-kf3XOj2dCs7aqMIoBA-1; Fri, 25 Mar 2022 06:37:39 -0400
Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com
 [10.11.54.10])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 70B941044562;
	Fri, 25 Mar 2022 10:37:39 +0000 (UTC)
Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com
 (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100])
	by smtp.corp.redhat.com (Postfix) with ESMTP id 69248401E25;
	Fri, 25 Mar 2022 10:37:39 +0000 (UTC)
Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com
 (localhost [IPv6:::1])
	by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with
 ESMTP id 41E18194034E;
	Fri, 25 Mar 2022 10:37:39 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com
 [10.11.54.7])
 by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with
 ESMTP id 484C9194034E for <patchew-devel@listman.corp.redhat.com>;
 Fri, 25 Mar 2022 10:37:37 +0000 (UTC)
Received: by smtp.corp.redhat.com (Postfix)
 id 2C902141DED6; Fri, 25 Mar 2022 10:37:37 +0000 (UTC)
Received: from avogadro.redhat.com (unknown [10.39.195.65])
 by smtp.corp.redhat.com (Postfix) with ESMTP id B63ED145455C
 for <patchew-devel@redhat.com>; Fri, 25 Mar 2022 10:37:36 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
	s=mimecast20190719; t=1648204667;
	h=from:from:sender:sender:reply-to:subject:subject:date:date:
	 message-id:message-id:to:to:cc:mime-version:mime-version:
	 content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references:list-id:list-help:
	 list-unsubscribe:list-subscribe:list-post;
	bh=fBkbHkgxixl5nD7NilSm28gw+DtO0wYXRR1QUKUx3rA=;
	b=D053vtFt4Ct4KTt1ZM6vcP+vWcRUSqWMVv0iS5lUc53BaKtYrCq0KqB31+BAlzaylbVULM
	hV4Ooht3pnYuAJ8T+/8fRGKPa/jCi/P2IGd3Pp7qCQpLWMxSxGmY+adZXDP7z3XcC07ugP
	vd9QtLScj8Wk+32pJksoJn/0kDtgZX0=
X-MC-Unique: qms-kf3XOj2dCs7aqMIoBA-1
X-Original-To: patchew-devel@listman.corp.redhat.com
From: Paolo Bonzini <pbonzini@redhat.com>
To: patchew-devel@redhat.com
Date: Fri, 25 Mar 2022 11:37:32 +0100
Message-Id: <20220325103733.296529-4-pbonzini@redhat.com>
In-Reply-To: <20220325103733.296529-1-pbonzini@redhat.com>
References: <20220325103733.296529-1-pbonzini@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7
Subject: [Patchew-devel] [PATCH 3/4] www: make bottom button more generic
X-BeenThere: patchew-devel@redhat.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Patchew development and discussion list <patchew-devel.redhat.com>
List-Unsubscribe: <https://listman.redhat.com/mailman/options/patchew-devel>,
 <mailto:patchew-devel-request@redhat.com?subject=unsubscribe>
List-Archive: <http://listman.redhat.com/archives/patchew-devel/>
List-Post: <mailto:patchew-devel@redhat.com>
List-Help: <mailto:patchew-devel-request@redhat.com?subject=help>
List-Subscribe: <https://listman.redhat.com/mailman/listinfo/patchew-devel>,
 <mailto:patchew-devel-request@redhat.com?subject=subscribe>
Errors-To: patchew-devel-bounces@redhat.com
Sender: "Patchew-devel" <patchew-devel-bounces@redhat.com>
X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10
Authentication-Results: relay.mimecast.com;
	auth=pass smtp.auth=CUSA124A263
 smtp.mailfrom=patchew-devel-bounces@redhat.com
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Content-Transfer-Encoding: quoted-printable
X-ZohoMail-DKIM: pass (identity @redhat.com)
X-ZM-MESSAGEID: 1648204669996100019
Content-Type: text/plain; charset="utf-8"

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 mods/maintainer.py             | 22 +++++++++++++++++-----
 www/templates/series-list.html | 22 ++++++++--------------
 www/views.py                   |  6 ++++++
 3 files changed, 31 insertions(+), 19 deletions(-)

diff --git a/mods/maintainer.py b/mods/maintainer.py
index f183c90..a553ba9 100644
--- a/mods/maintainer.py
+++ b/mods/maintainer.py
@@ -246,10 +246,16 @@ class MaintainerModule(PatchewModule):
     def render_page_hook(self, request, context_data):
         if request.user.is_authenticated and context_data.get("is_search"):
             q =3D WatchedQuery.objects.filter(user=3Drequest.user).first()
-            if q:
-                context_data["has_watched_query"] =3D True
-                if q.query =3D=3D context_data.get("search"):
-                    context_data["is_watched_query"] =3D True
+            if q and q.query.strip() =3D=3D context_data.get("search").str=
ip():
+                context_data["is_watched_query"] =3D True
+            else:
+                context_data.update(
+                    {
+                        "button_text": "Replace watched query" if q else "=
Watch query",
+                        "button_data": {"q": context_data["search"]},
+                        "button_url": reverse("maintainer_watch_query"),
+                    }
+                )
=20
     @method_decorator(www_authenticated_op)
     def www_view_watch_query(self, request):
@@ -328,7 +334,13 @@ class MaintainerModule(PatchewModule):
             url(r"^my-queues/(?P<project>[^/]*)/$", self.www_view_my_queue=
s)
         )
         urlpatterns.append(url(r"^my-queues/$", self.www_view_my_queues))
-        urlpatterns.append(url(r"^watch-query/$", self.www_view_watch_quer=
y))
+        urlpatterns.append(
+            url(
+                r"^watch-query/$",
+                self.www_view_watch_query,
+                name=3D"maintainer_watch_query",
+            )
+        )
=20
     def prepare_message_hook(self, request, message, detailed):
         def link_queue(message, queue, text):
diff --git a/www/templates/series-list.html b/www/templates/series-list.html
index beddc90..9ff621e 100644
--- a/www/templates/series-list.html
+++ b/www/templates/series-list.html
@@ -81,20 +81,14 @@
     </div>
 {% endif %}
=20
-{% if is_search %}
-    {% if is_watched_query %}
-        <p>Saved as my watched query</p>
-    {% elif has_watched_query %}
-        <form method=3D"post" action=3D"/watch-query/">{% csrf_token %}
-        <input type=3D"hidden" name=3D"q" value=3D"{{ search }}">
-        <input type=3D"hidden" name=3D"next" value=3D"{{ request.get_full_=
path }}">
-        <button type=3D"submit">Replace watched query</button></form>
-    {% else %}
-        <form method=3D"post" action=3D"/watch-query/">{% csrf_token %}
-        <input type=3D"hidden" name=3D"q" value=3D"{{ search }}">
-        <input type=3D"hidden" name=3D"next" value=3D"{{ request.get_full_=
path }}">
-        <button type=3D"submit">Watch query</button></form>
-    {% endif %}
+{% if is_watched_query %}
+    <p>Saved as my watched query</p>
+{% endif %}
+{% if button_url %}
+<form method=3D"post" action=3D"{{ button_url }}">{% csrf_token %}
+{% for name, value in button_data.items %}<input type=3D"hidden" name=3D"{=
{ name }}" value=3D"{{ value }}">
+{% endfor %}<input type=3D"hidden" name=3D"next" value=3D"{{ request.get_f=
ull_path }}">
+<button type=3D"submit">{{ button_text }}</button></form>
 {% endif %}
=20
 <nav>
diff --git a/www/views.py b/www/views.py
index edfe2ce..fe19d84 100644
--- a/www/views.py
+++ b/www/views.py
@@ -194,6 +194,9 @@ def render_series_list_page(
     link_text=3DNone,
     keywords=3D[],
     is_search=3DFalse,
+    button_url=3DNone,
+    button_data=3DNone,
+    button_text=3DNone,
 ):
     sort =3D request.GET.get("sort")
     cur_page =3D get_page_from_request(request)
@@ -243,6 +246,9 @@ def render_series_list_page(
         keywords=3Dkeywords,
         order_by_reply=3Dorder_by_reply,
         navigate_links=3Dnav_path,
+        button_url=3Dbutton_url,
+        button_data=3Dbutton_data,
+        button_text=3Dbutton_text,
     )
=20
=20
--=20
2.35.1


_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/patchew-devel
From nobody Tue Jan  7 08:31:38 2025
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of redhat.com designates
 170.10.133.124 as permitted sender) client-ip=170.10.133.124;
 envelope-from=patchew-devel-bounces@redhat.com;
 helo=us-smtp-delivery-124.mimecast.com;
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as
 permitted sender)  smtp.mailfrom=patchew-devel-bounces@redhat.com;
	dmarc=pass(p=none dis=none)  header.from=redhat.com
ARC-Seal: i=1; a=rsa-sha256; t=1648204663; cv=none;
	d=zohomail.com; s=zohoarc;
	b=EBCCWV4API9xzg9k8V+2SnXPudG5tkSxBv7DEC6PxEm5ulKdqAHigVjGU7NODjPndkUI/Njbqxt3c1M7wz4SitdkAZuI/xzT7sUkfq6IxT/wtttmX3IVoJJlStIMxptNBn50cnGzPMA4UInmPdwfxTzkvlYKTinKxVBTlmiC7lA=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1648204663;
 h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=FKUgCc1msmn8kcs/8XLAD5/cHK878fQq4uYeSxTTbMY=;
	b=giURZQAwVfnCE8WzaBQP7WQCFapJ9qEdMjjv5K5c8T1QnreT8gHcOYQvvfIrSIkwGqLhp+ZAF/LTcUQF0T8r62uHpyuUIQzayxjRFz37pcVET0kpoFdjGmjg6uqARfSiSd+hklCO/sO24/cwx2wFPlyX+yw65GaIlS7qDTmamSo=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as
 permitted sender)  smtp.mailfrom=patchew-devel-bounces@redhat.com;
	dmarc=pass header.from=<pbonzini@redhat.com> (p=none dis=none)
Return-Path: <patchew-devel-bounces@redhat.com>
Received: from us-smtp-delivery-124.mimecast.com
 (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com
	with SMTPS id 16482046638141003.4748310721479;
 Fri, 25 Mar 2022 03:37:43 -0700 (PDT)
Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com
 [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS
 (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 us-mta-130-bqr2i0jQOAmZNOnSAANx1Q-1; Fri, 25 Mar 2022 06:37:39 -0400
Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com
 [10.11.54.10])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3E8EA811E75;
	Fri, 25 Mar 2022 10:37:39 +0000 (UTC)
Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com
 (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100])
	by smtp.corp.redhat.com (Postfix) with ESMTP id 36AA2401E25;
	Fri, 25 Mar 2022 10:37:39 +0000 (UTC)
Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com
 (localhost [IPv6:::1])
	by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with
 ESMTP id 13AB9194034E;
	Fri, 25 Mar 2022 10:37:39 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com
 [10.11.54.7])
 by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with
 ESMTP id F3B3D1940341 for <patchew-devel@listman.corp.redhat.com>;
 Fri, 25 Mar 2022 10:37:37 +0000 (UTC)
Received: by smtp.corp.redhat.com (Postfix)
 id E4E8C1454556; Fri, 25 Mar 2022 10:37:37 +0000 (UTC)
Received: from avogadro.redhat.com (unknown [10.39.195.65])
 by smtp.corp.redhat.com (Postfix) with ESMTP id 76AF3141DED6
 for <patchew-devel@redhat.com>; Fri, 25 Mar 2022 10:37:37 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
	s=mimecast20190719; t=1648204662;
	h=from:from:sender:sender:reply-to:subject:subject:date:date:
	 message-id:message-id:to:to:cc:mime-version:mime-version:
	 content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references:list-id:list-help:
	 list-unsubscribe:list-subscribe:list-post;
	bh=FKUgCc1msmn8kcs/8XLAD5/cHK878fQq4uYeSxTTbMY=;
	b=hPfWaNMJICTE6l79rxCN8OtUJzLFfp1yIZQ6sehSI+Ayv8UQL0gDEdgnzQC2XWpTF951ZH
	MWajVZemydTnu2tsUcDhTwKivq0lzJ6pD9lQPuizGaNYrdm9kUozaAGPlWhZ7jXT++QG6p
	nFctmc6dYLmSc3RNGUnBmo49q4BRLio=
X-MC-Unique: bqr2i0jQOAmZNOnSAANx1Q-1
X-Original-To: patchew-devel@listman.corp.redhat.com
From: Paolo Bonzini <pbonzini@redhat.com>
To: patchew-devel@redhat.com
Date: Fri, 25 Mar 2022 11:37:33 +0100
Message-Id: <20220325103733.296529-5-pbonzini@redhat.com>
In-Reply-To: <20220325103733.296529-1-pbonzini@redhat.com>
References: <20220325103733.296529-1-pbonzini@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7
Subject: [Patchew-devel] [PATCH 4/4] maintainer: add buttons for quick
 emptying of patch queues
X-BeenThere: patchew-devel@redhat.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Patchew development and discussion list <patchew-devel.redhat.com>
List-Unsubscribe: <https://listman.redhat.com/mailman/options/patchew-devel>,
 <mailto:patchew-devel-request@redhat.com?subject=unsubscribe>
List-Archive: <http://listman.redhat.com/archives/patchew-devel/>
List-Post: <mailto:patchew-devel@redhat.com>
List-Help: <mailto:patchew-devel-request@redhat.com?subject=help>
List-Subscribe: <https://listman.redhat.com/mailman/listinfo/patchew-devel>,
 <mailto:patchew-devel-request@redhat.com?subject=subscribe>
Errors-To: patchew-devel-bounces@redhat.com
Sender: "Patchew-devel" <patchew-devel-bounces@redhat.com>
X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10
Authentication-Results: relay.mimecast.com;
	auth=pass smtp.auth=CUSA124A263
 smtp.mailfrom=patchew-devel-bounces@redhat.com
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Content-Transfer-Encoding: quoted-printable
X-ZohoMail-DKIM: pass (identity @redhat.com)
X-ZM-MESSAGEID: 1648204665964100013
Content-Type: text/plain; charset="utf-8"

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 mods/maintainer.py | 44 +++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 41 insertions(+), 3 deletions(-)

diff --git a/mods/maintainer.py b/mods/maintainer.py
index a553ba9..96e2747 100644
--- a/mods/maintainer.py
+++ b/mods/maintainer.py
@@ -170,6 +170,19 @@ class MaintainerModule(PatchewModule):
             return HttpResponseBadRequest("Invalid queue name")
         self._add_to_queue(request.user, [m], queue)
=20
+    @method_decorator(www_authenticated_op)
+    def www_view_search_drop_from_queue(self, request, queue, project):
+        po =3D Project.objects.filter(name=3Dproject).first()
+        if not po:
+            raise Http404("Project not found")
+        if not queue or re.match(r"[^_a-zA-Z0-9\-]", queue):
+            return HttpResponseBadRequest("Invalid queue name")
+        q =3D request.POST.get("q")
+        se =3D SearchEngine(["queue:" + queue, q], request.user)
+        self._drop_from_queue(
+            request.user, se.search_series(Message.objects.series_heads(po=
.id)), queue
+        )
+
     @method_decorator(www_authenticated_op)
     def www_view_drop_from_queue(self, request, queue, project, message_id=
):
         m =3D Message.objects.find_series(message_id, project)
@@ -177,12 +190,12 @@ class MaintainerModule(PatchewModule):
             raise Http404("Series not found")
         self._drop_from_queue(request.user, m, queue)
=20
-    def query_queue(self, request, project, name):
+    def query_queue(self, request, project, name, can_be_empty=3DFalse):
         if not request.user.is_authenticated:
             raise PermissionDenied()
=20
         q =3D QueuedSeries.objects.filter(user=3Drequest.user, name=3Dname)
-        if not q.first():
+        if not can_be_empty and not q.first():
             raise Http404("Queue not found")
         po =3D Project.objects.filter(name=3Dproject).first()
         if not po:
@@ -199,7 +212,7 @@ class MaintainerModule(PatchewModule):
         return HttpResponse(mbox, content_type=3D"text/plain")
=20
     def www_view_queue(self, request, project, name):
-        query =3D self.query_queue(request, project, name)
+        query =3D self.query_queue(request, project, name, can_be_empty=3D=
True)
         if name =3D=3D "watched":
             # TODO: make the WatchedQuery per-project
             q =3D WatchedQuery.objects.filter(user=3Drequest.user).first()=
.query
@@ -208,6 +221,23 @@ class MaintainerModule(PatchewModule):
                 q =3D "project:" + project + " " + q
         else:
             q =3D "project:" + project + " queue:" + name
+        extra =3D {}
+        if name =3D=3D "accept":
+            extra =3D {
+                "button_text": "Remove merged patches",
+                "button_data": {"q": "is:merged"},
+                "button_url": reverse(
+                    "search-drop-from-queue", kwargs=3D{"project": project=
, "queue": name}
+                ),
+            }
+        elif name not in ["reject", "watched"]:
+            extra =3D {
+                "button_text": "Remove accepted/merged/rejected patches",
+                "button_data": {"q": "{is:merged review:me}"},
+                "button_url": reverse(
+                    "search-drop-from-queue", kwargs=3D{"project": project=
, "queue": name}
+                ),
+            }
         return render_series_list_page(
             request,
             query,
@@ -219,6 +249,7 @@ class MaintainerModule(PatchewModule):
             link_url=3Dreverse(
                 "maintainer_queue_mbox", kwargs=3D{"project": project, "na=
me": name}
             ),
+            **extra,
         )
=20
     def www_view_my_queues(self, request, project=3DNone):
@@ -316,6 +347,13 @@ class MaintainerModule(PatchewModule):
                 name=3D"drop-from-queue",
             )
         )
+        urlpatterns.append(
+            url(
+                r"^my-queues/(?P<project>[^/]*)/(?P<queue>[^/]*)/remove/",
+                self.www_view_search_drop_from_queue,
+                name=3D"search-drop-from-queue",
+            )
+        )
         urlpatterns.append(
             url(
                 r"^my-queues/(?P<project>[^/]*)/(?P<name>[^/]*)/$",
--=20
2.35.1

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