From nobody Sat Dec 14 20:38:44 2024 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=1645538547; cv=none; d=zohomail.com; s=zohoarc; b=VbR3pIjoCTfdEZGA81gCC5GSjM9UVN0PEHsjFUG0wcpa/SrCPliIvuLoqCugf6dgMU1DyT904AJBPl4ylYS8SBO66CM3KyxXUyev1795AJkb3ieW6u6+sv30MDK5Z89PEGEEUEOrCswD4269ixzOU2h9CN5yVYKGu2nE8OlwKcY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1645538547; 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=jgMr4FPEHMSaUQ/b+eF2Y64TgOsbnjlp8T4mogNLRts=; b=oB/O8D1bR1trOBuWJN8Yf23GOPJZl1qjrJw0+LhgocacLdWaqOLgysg0R9bj7PMiMtdNjScYv0XLYhZRYj7ft0uOijh0eBccw/GvNQ7q4wfR0g/XxBgGQ/G+CJyFGRaTjgOu32cibUweEqu3//4g//imokvXJ0ByurXyM9UiSQo= 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 1645538547393713.1693239862467; Tue, 22 Feb 2022 06:02:27 -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-577-qLTmKvsSPEKHFjS_4K0f4w-1; Tue, 22 Feb 2022 09:01:50 -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 D1C5A8031E1; Tue, 22 Feb 2022 14:01:48 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C90E1843EC; Tue, 22 Feb 2022 14:01:48 +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 C1B6C1809CB2; Tue, 22 Feb 2022 14:01:48 +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 21ME1mn3000672 for ; Tue, 22 Feb 2022 09:01:48 -0500 Received: by smtp.corp.redhat.com (Postfix) id 208588328D; Tue, 22 Feb 2022 14:01:48 +0000 (UTC) Received: from avogadro.lan (unknown [10.39.195.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8B180832AF for ; Tue, 22 Feb 2022 14:01:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645538546; 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=jgMr4FPEHMSaUQ/b+eF2Y64TgOsbnjlp8T4mogNLRts=; b=DpOE4rOjll9QpT/s9+ae77+JRGQUwWq1JvsGrgzdb76ZgV8tP3cJrJdpBPXAg9liOjM86B tghiP0aQDak7ZkJShD5ZxVoARwaNGO6PAuhtyCk/sjHyrBCr03kHwdn8JYkWSmzjk5NUVe 2/p+mLclh5od9RxXXhSxeyzUQz8MfnY= X-MC-Unique: qLTmKvsSPEKHFjS_4K0f4w-1 From: Paolo Bonzini To: patchew-devel@redhat.com Date: Tue, 22 Feb 2022 15:01:39 +0100 Message-Id: <20220222140141.190989-2-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 1/3] www: allow more customization of the series list 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: 1645538550214100003 Content-Type: text/plain; charset="utf-8" Prepare for having the queues in series list format. Signed-off-by: Paolo Bonzini --- www/templates/series-list.html | 14 ++++++++++---- www/views.py | 19 ++++++++++++++----- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/www/templates/series-list.html b/www/templates/series-list.html index 27c0d9c..2e5b06e 100644 --- a/www/templates/series-list.html +++ b/www/templates/series-list.html @@ -11,14 +11,20 @@

{% block title %} - {% if is_search %}Search results{% else %}All series{% endif %} - {% if project is not None %}for {{ project }}{% endif %} + {{ title }} {% endblock %}

-{% if not is_search %} -

More informati= on about {{ project }}...

+ +{% if link_text %} +
+
+ {% if link_icon %} {% endif= %} + +
+
{% endif %} =20 + {% if series %} diff --git a/www/views.py b/www/views.py index d328b43..5ce44f3 100644 --- a/www/views.py +++ b/www/views.py @@ -173,7 +173,9 @@ def prepare_navigate_list(cur, *path): return r =20 =20 -def render_series_list_page(request, query, search=3DNone, project=3DNone,= keywords=3D[]): +def render_series_list_page(request, query, search=3DNone, project=3DNone, + title=3D'Search results', link_icon=3DNone, + link_url=3DNone, link_text=3DNone, keywords=3D= []): sort =3D request.GET.get("sort") if sort =3D=3D "replied": query =3D query.order_by(F('last_reply_date').desc(nulls_last=3DTr= ue), '-date') @@ -191,7 +193,6 @@ def render_series_list_page(request, query, search=3DNo= ne, project=3DNone, keywords=3D if sort: params +=3D "&" + urllib.parse.urlencode({"sort": sort}) if search is not None: - is_search =3D True params +=3D "&" + urllib.parse.urlencode({"q": search}) cur =3D 'search "%s"' % search if project: @@ -201,18 +202,22 @@ def render_series_list_page(request, query, search=3D= None, project=3DNone, keywords=3D else: nav_path =3D prepare_navigate_list(cur) else: - is_search =3D False search =3D "project:%s" % project nav_path =3D prepare_navigate_list(project) page_links =3D gen_page_links(query.count(), cur_page, PAGE_SIZE, para= ms) + if project: + title +=3D ' for ' + project return render_page( request, "series-list.html", series=3Dprepare_series_list(request, series), page_links=3Dpage_links, search=3Dsearch, + title=3Dtitle, project=3Dproject, - is_search=3Dis_search, + link_icon=3Dlink_icon, + link_url=3Dlink_url, + link_text=3Dlink_text, keywords=3Dkeywords, order_by_reply=3Dorder_by_reply, navigate_links=3Dnav_path, @@ -269,7 +274,11 @@ def view_series_list(request, project): if not prj: raise Http404("Project not found") query =3D api.models.Message.objects.series_heads(prj.id) - return render_series_list_page(request, query, project=3Dproject) + return render_series_list_page(request, query, project=3Dproject, + title=3D'All series', + link_icon=3D'fa fa-list', + link_url=3Dreverse("project_detail", kw= args=3D{"project": project}), + link_text=3D'More information about ' += project + '...') =20 =20 def view_mbox(request, project, message_id): --=20 2.34.1 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://listman.redhat.com/mailman/listinfo/patchew-devel From nobody Sat Dec 14 20:38:44 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
{% for qn, msgs in queues.items %} -

Queue: {{ qn }} [{{ p }}]

+

Queue:= {{ qn }} [{{ p }}]