From nobody Thu Apr 25 12:43:11 2024 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=1645538516; cv=none; d=zohomail.com; s=zohoarc; b=ATnRwnVCnCArVDaakD+Cjfv0u5Eke6mtrOidDdK2rsh0q9Qe6D6K/kj3xkOkMRQpPXvjs0HIrx9KnSUMRPIgKa8CmdED2YGnS37gM1X//sSQN7XBgni6WWjwvV4WGIoV5C1r2fSUC1xAcRfUIsI0xN59221Sp6e44YXVfS1Z8zA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1645538516; 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=U38i3uelkVHngmcT9LJdoHLM9fkYhceMVUKMpj4CTpk=; b=dWj3Uw9XK7KSjJH2Ui177/tBqThGuZS/l7svfOEzF6PkmKJ9/Cqa9djngNP7oHonHaHJ6ENGNS5zxbKDSa5/uzw8djkZvqhdUFD3E7iR2qu2zaZ4zZZjOLiit+AkTi9rhujX+UMYBEWnX3T2d7/aFkRjRwKeaCA9zPjqVl6jx80= 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 1645538516496794.4653605786458; Tue, 22 Feb 2022 06:01:56 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-56-2AxCD8CXP8CDnOWtL2QvUg-1; Tue, 22 Feb 2022 09:01:51 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1F1B0100C660; Tue, 22 Feb 2022 14:01:50 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 16D3C843EA; Tue, 22 Feb 2022 14:01:50 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 0F4B646F98; Tue, 22 Feb 2022 14:01:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 21ME1nxH000685 for ; Tue, 22 Feb 2022 09:01:49 -0500 Received: by smtp.corp.redhat.com (Postfix) id 12040832B4; Tue, 22 Feb 2022 14:01:49 +0000 (UTC) Received: from avogadro.lan (unknown [10.39.195.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7A843832AF for ; Tue, 22 Feb 2022 14:01:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645538515; 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=U38i3uelkVHngmcT9LJdoHLM9fkYhceMVUKMpj4CTpk=; b=c3HPnwY/XHpq2SBce5JzheWI2eR5yxzzH3Yqrb9y/kSB4ueBnM4t4yRu7awsIrG8Ouz3AZ YezfZZjmbZp8K4MTXBlhDeT2z/Eis2tt0BQCR124yZ5lkU0pdShA7PyDErRAMOlxMZRj6+ dneOh1hq1oPslJKUtbKl3AdvuMAekFc= X-MC-Unique: 2AxCD8CXP8CDnOWtL2QvUg-1 From: Paolo Bonzini To: patchew-devel@redhat.com Date: Tue, 22 Feb 2022 15:01:40 +0100 Message-Id: <20220222140141.190989-3-pbonzini@redhat.com> In-Reply-To: <20220222140141.190989-1-pbonzini@redhat.com> References: <20220222140141.190989-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH 2/3] maintainer: allow showing queue in series-list format X-BeenThere: patchew-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Patchew development and discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: patchew-devel-bounces@redhat.com Errors-To: patchew-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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: 1645538517066100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Paolo Bonzini --- mods/maintainer.py | 41 ++++++++++++++++++++++++++++++------ www/templates/my-queues.html | 2 +- 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/mods/maintainer.py b/mods/maintainer.py index 70d0ea5..d650ec4 100644 --- a/mods/maintainer.py +++ b/mods/maintainer.py @@ -14,10 +14,11 @@ from django.core.exceptions import PermissionDenied from django.http import Http404, HttpResponseRedirect, HttpResponseBadRequ= est from django.urls import reverse from mod import PatchewModule -from api.models import Message, QueuedSeries, WatchedQuery +from api.models import Message, QueuedSeries, Project, WatchedQuery from django.shortcuts import render from api.search import SearchEngine from event import declare_event, register_handler, emit_event +from www.views import render_series_list_page =20 =20 class MaintainerModule(PatchewModule): @@ -164,13 +165,37 @@ class MaintainerModule(PatchewModule): self._drop_from_queue(request.user, m, queue) return HttpResponseRedirect(request.META.get("HTTP_REFERER")) =20 - def www_view_my_queues(self, request): + def www_view_queue(self, request, project, name): + if not request.user.is_authenticated: + raise PermissionDenied() + + q =3D QueuedSeries.objects.filter(user=3Drequest.user, name=3Dname= ).first() + if not q: + raise Http404("Queue not found") + po =3D Project.objects.filter(name=3Dproject).first() + if not po: + raise Http404("Project not found") + + search =3D 'project:' + project + ' queue:' + name + query =3D Message.objects.series_heads(po.id).filter(queuedseries= =3Dq) + return render_series_list_page(request, query, + search=3Dsearch, project=3Dproject, + title=3D'"' + name + '" queue') + + def www_view_my_queues(self, request, project=3DNone): if not request.user.is_authenticated: raise PermissionDenied() data =3D {} - for i in QueuedSeries.objects.filter( - user=3Drequest.user - ).order_by("message__project", "name", "message__date"): + q =3D QueuedSeries.objects.filter(user=3Drequest.user) + if project: + po =3D Project.objects.filter(name=3Dproject).first() + if not po: + raise Http404("Project not found") + q =3D q.filter(message__project=3Dpo) + else: + q =3D q.order_by("message__project") + + for i in q.order_by("name", "message__date"): pn =3D i.message.project.name qn =3D i.name data.setdefault(pn, {}) @@ -248,8 +273,10 @@ class MaintainerModule(PatchewModule): name=3D"drop-from-queue", ) ) - urlpatterns.append(url(r"^my-queues/", self.www_view_my_queues)) - urlpatterns.append(url(r"^watch-query/", self.www_view_watch_query= )) + urlpatterns.append(url(r"^my-queues/(?P[^/]*)/(?P[^= /]*)/$", self.www_view_queue, name=3D"maintainer_queue")) + urlpatterns.append(url(r"^my-queues/(?P[^/]*)/$", self.ww= w_view_my_queues)) + urlpatterns.append(url(r"^my-queues/$", self.www_view_my_queues)) + urlpatterns.append(url(r"^watch-query/$", self.www_view_watch_quer= y)) =20 def prepare_message_hook(self, request, message, detailed): if message.maintainers: diff --git a/www/templates/my-queues.html b/www/templates/my-queues.html index bc63a0e..7eb789e 100644 --- a/www/templates/my-queues.html +++ b/www/templates/my-queues.html @@ -29,7 +29,7 @@ =20