From nobody Mon Sep 16 19:45:51 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=patchew-devel-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1542766208289202.91843560386462; Tue, 20 Nov 2018 18:10:08 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8A35489AD1; Wed, 21 Nov 2018 02:10:07 +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 7577E662F8; Wed, 21 Nov 2018 02:10:07 +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 6790D3F7CB; Wed, 21 Nov 2018 02:10:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wAL2A5p8006154 for ; Tue, 20 Nov 2018 21:10:05 -0500 Received: by smtp.corp.redhat.com (Postfix) id BB44D66077; Wed, 21 Nov 2018 02:10:05 +0000 (UTC) Received: from magic.redhat.com (ovpn-12-78.pek2.redhat.com [10.72.12.78]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5A7EB6607B; Wed, 21 Nov 2018 02:10:00 +0000 (UTC) From: Fam Zheng To: patchew-devel@redhat.com Date: Wed, 21 Nov 2018 10:08:41 +0800 Message-Id: <20181121020846.7875-12-famz@redhat.com> In-Reply-To: <20181121020846.7875-1-famz@redhat.com> References: <20181121020846.7875-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: patchew-devel@redhat.com Cc: ymankad@redhat.com, armbru@redhat.com Subject: [Patchew-devel] [PATCH 11/16] www: Add /my-queues page 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: patchew-devel-bounces@redhat.com Errors-To: patchew-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 21 Nov 2018 02:10:07 +0000 (UTC) Content-Type: text/plain; charset="utf-8" This new page lists the user's queues and the patches added to them. Signed-off-by: Fam Zheng --- mods/maintainer.py | 17 ++++++++ www/templates/base.html | 3 ++ www/templates/my-queues.html | 82 ++++++++++++++++++++++++++++++++++++ 3 files changed, 102 insertions(+) create mode 100644 www/templates/my-queues.html diff --git a/mods/maintainer.py b/mods/maintainer.py index a92995f..665b074 100644 --- a/mods/maintainer.py +++ b/mods/maintainer.py @@ -14,6 +14,7 @@ from django.http import Http404, HttpResponseRedirect, Ht= tpResponseBadRequest from django.urls import reverse from mod import PatchewModule from api.models import Message, Queue, WatchedQuery +from django.shortcuts import render from api.search import SearchEngine from event import register_handler =20 @@ -123,6 +124,21 @@ 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): + if not request.user.is_authenticated: + raise PermissionDenied() + data =3D {} + for i in Queue.objects.filter(message__is_patch=3DTrue, + user=3Drequest.user).\ + order_by("message__project", "name", "message__date"): + pn =3D i.message.project.name + qn =3D i.name + data.setdefault(pn, {}) + data[pn].setdefault(qn, []) + data[pn][qn].append(i.message) + + return render(request, "my-queues.html", context=3D{"projects": da= ta}) + 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() @@ -161,6 +177,7 @@ class MaintainerModule(PatchewModule): urlpatterns.append(url(r"^drop-from-queue/(?P[^/]*)/(?P.*)/", self.www_view_drop_from_queue, 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= )) =20 def prepare_message_hook(self, request, message, detailed): diff --git a/www/templates/base.html b/www/templates/base.html index 89dabcf..60e6178 100644 --- a/www/templates/base.html +++ b/www/templates/base.html @@ -74,6 +74,9 @@ crossorigin=3D"anonymous"/> Hi {{ user.username }}
    + {% if request.user.is_authenticated %} +
  • My queues<= /a>
  • + {% endif %} {% if request.user.is_staff %}
  • Admin
  • {% endif %} diff --git a/www/templates/my-queues.html b/www/templates/my-queues.html new file mode 100644 index 0000000..627dc5a --- /dev/null +++ b/www/templates/my-queues.html @@ -0,0 +1,82 @@ +{% extends 'base.html' %} + +{% block header %} + + + + + +{% endblock %} + +{% block title %}My queues{% endblock %} + +{% block content %} + +
    + +
    + +
    + + +{% if projects %} +{% for p, queues in projects.items %} + +
    + {% for qn, msgs in queues.items %} +

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

    + + {% endfor %} +
    + +{% endfor %} +{% else %} +

    You haven't created any queue

    +{% endif %} + + + +{% endblock %} --=20 2.17.2 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel