From nobody Fri Apr 19 03:22:46 2024 Delivered-To: importer2@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=ixOHi6/FQ6ltEXS8B8/4fG3VMfgJiFyj0SC14FELi23MfLJa/W8PmxQZSZ/l411KlFVRlODUSKaMn2Oy34FLNCBzpt287cjS69Ahyr49uP1nL3JR5XZBGoeRzA2WDLP6hv1xYgchd6zDA9TRzaK7/BFgYbkYuvLnD7l8iPOnF00= 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=dZDD3pptWX15eO2eIWhCS4qHuIT0d5M/PDvi4VgwJus=; b=VqAGiCEsiCEtmDkszGhYbpruNVNn57okBYVs6CDUS7lBnmteXjcQK157mibqBhgLU7WRMP0QpElWqUvXJVzu8/ViXoAb0lzM6Oyy2+47W2IcY+dHfZxk1P7tspZC+k0xrNm1znxLhLns1XFvUCU+ojfPPh2wkJQUWykFo7s/4kw= 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= (p=none dis=none) Return-Path: 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 1648204663123355.21266747917; 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-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 ; 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 ; 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 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: patchew-devel-bounces@redhat.com Sender: "Patchew-devel" 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: 1648205565451100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Paolo Bonzini --- 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 Fri Apr 19 03:22:46 2024 Delivered-To: importer2@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= (p=none dis=none) Return-Path: 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 1648204662325202.38159146437295; 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 ; 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 ; 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=1648204659; 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=YeFcyaqDYBL0slfbtZqQEC0Zp3zCUfl3CTCG8WJApJcgr6XQTnU4ZA/y9OINz6mF7x4h7T VPQNcXCgsNL3HgJnDh1VPnsfnWgoTYHZ5FgzoAzGS56wj6Jm6Ibtx75AYizYTBxy5FfX29 H5RZbD0f1h1BCwllewg8ZwkbbKo5HKo= X-MC-Unique: -PcYj50jMN2SRLzWYvMqvw-1 X-Original-To: patchew-devel@listman.corp.redhat.com From: Paolo Bonzini 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: patchew-devel-bounces@redhat.com Sender: "Patchew-devel" 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: 1648204664089100009 Content-Type: text/plain; charset="utf-8" Signed-off-by: Paolo Bonzini --- 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 Fri Apr 19 03:22:46 2024 Delivered-To: importer2@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=1648204667; cv=none; d=zohomail.com; s=zohoarc; b=Vi3qAkDyxDPbtmVvHBQNB04NQE919zaadCs4m7+6N5QB9i9WThjVGJpvrLtHKEhtvGtLygzeEmUd5bxUC7nmvovbuTzQ00C+1J4NRrsDlpytX4ACfuiGFpX8VeS+cUhdxfLmTd4jtXwdXkxBmqiZ9RHwHDmTJFrphCZlB1CkHYQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1648204667; 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=KYZ1lDR6mGKPI+Bn8+z1urhpy/tSdpgEpMclFqszV9gtdr2sPJRLab3ZKtajUCuSOQ0V90v6nnQbpi1flYYZ9kiKYMmYUeO2v2ejwKOLXoA6AzQNybkFkkkSMANermxaXZj4RxTdN/fsHNN6lkujCUrqduNjSYjI2tg6IUTJ3V8= 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= (p=none dis=none) Return-Path: 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 1648204667083729.549935794133; Fri, 25 Mar 2022 03:37:47 -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 ; 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 ; 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=1648204666; 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=GKFV9H7Ko/zKvGseXyLnBjfsgWzFHvKJmQ9GdUEFBed1XM4HBnvSqnj1DEoIIgfaX142ug pd9ppLIew1xxM1SueKmm8AJ7AbTS9EAuQGP2/Eh9rys631e3fQbNFoQK/Ax7oeA/WWnRiY 2NJ1mj9WgrMHsQNQMDbNYzksdgAQYVk= X-MC-Unique: qms-kf3XOj2dCs7aqMIoBA-1 X-Original-To: patchew-devel@listman.corp.redhat.com From: Paolo Bonzini 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: patchew-devel-bounces@redhat.com Sender: "Patchew-devel" 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: 1648204668104100017 Content-Type: text/plain; charset="utf-8" Signed-off-by: Paolo Bonzini --- 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[^/]*)/$", 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 @@ {% endif %} =20 -{% if is_search %} - {% if is_watched_query %} -

Saved as my watched query

- {% elif has_watched_query %} -
{% csrf_token %} - - -
- {% else %} -
{% csrf_token %} - - -
- {% endif %} +{% if is_watched_query %} +

Saved as my watched query

+{% endif %} +{% if button_url %} +
{% csrf_token %} +{% for name, value in button_data.items %} +{% endfor %} +
{% endif %} =20