From nobody Mon Sep 16 19:09:56 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; dkim=fail header.i=fam@euphon.net; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1543415783662784.5990144575687; Wed, 28 Nov 2018 06:36:23 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6BACD83F63; Wed, 28 Nov 2018 14:36:22 +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 566686837B; Wed, 28 Nov 2018 14:36:22 +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 46E6641FB9; Wed, 28 Nov 2018 14:36:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wASEaL4S032008 for ; Wed, 28 Nov 2018 09:36:21 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7386C5C21E; Wed, 28 Nov 2018 14:36:21 +0000 (UTC) Received: from mx1.redhat.com (ext-mx20.extmail.prod.ext.phx2.redhat.com [10.5.110.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 512AE7C278; Wed, 28 Nov 2018 14:36:17 +0000 (UTC) Received: from sender1.zoho.com.cn (sender2-op-o12.zoho.com.cn [163.53.93.243]) by mx1.redhat.com (Postfix) with ESMTP id 24CCC3086252; Wed, 28 Nov 2018 14:35:59 +0000 (UTC) Received: from localhost.localdomain (123.112.65.99 [123.112.65.99]) by mx.zoho.com.cn with SMTPS id 1543415753165603.9947265359569; Wed, 28 Nov 2018 22:35:53 +0800 (CST) ARC-Seal: i=1; a=rsa-sha256; t=1543415757; cv=none; d=zoho.com.cn; s=zohoarc; b=evEsBE3Q6f4n4bLZZRZrTjJgBDO/w0E5uT6/tGyo1iPMG73LmegHa+4aVH0tAIaa90ofqg3YGayfa+kX62Wwcv/533T78HNiVbfBSvEvCPajHWI31CDhRvGExcoFOc5KuN4eoOcVWiVdcgaobIiz51AFm6l1zwxaF5AqGcwL7zE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com.cn; s=zohoarc; t=1543415757; h=Cc:Date:From:In-Reply-To:Message-ID:References:Subject:To:ARC-Authentication-Results; bh=E3iB7p+E5XZW8o53NEnlQ/WAgx/BvwHEMXo3wpiJmp8=; b=fQAr9Jjt9g2L+HkF9ACbBd+AADQ1qDCOdgqU/5cwJlXUkfMG8I1sTb0D39AsT/ex3mGnGFmw6wDQmKe8Ee8vHhD4h58yacwHIMwU43Dd4Ul1MT6g2VCszXlJX9OWEtqNB2ctyB8zH6+bSKp2XsNDLQB+v92l2EJutP591dXgScs= ARC-Authentication-Results: i=1; mx.zoho.com.cn; dkim=pass header.i=euphon.net; spf=pass smtp.mailfrom=fam@euphon.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1543415757; s=zoho; d=euphon.net; i=fam@euphon.net; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; l=2340; bh=E3iB7p+E5XZW8o53NEnlQ/WAgx/BvwHEMXo3wpiJmp8=; b=Wp1c4A8B4ZL1KY5eif4aD8xecQFyEV0hm+KwLi7IoHe5bAehekUk/zQu/BCin8lz ImaAIKx7IHJ9fi6nHzwRxenrovmt/4UDUXry+kCC8EQcUjTScvpj0s+mmvaMr+xIfMT kSp7HnQALVLusd3V9ttMF+GStMM9v1L23so5TAJ0= From: Fam Zheng To: patchew-devel@redhat.com Date: Wed, 28 Nov 2018 22:34:59 +0800 Message-Id: <20181128143505.27730-7-fam@euphon.net> In-Reply-To: <20181128143505.27730-1-fam@euphon.net> References: <20181128143505.27730-1-fam@euphon.net> X-ZohoCNMailClient: External X-Greylist: Sender passed SPF test, ACL 238 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Wed, 28 Nov 2018 14:36:16 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Wed, 28 Nov 2018 14:36:16 +0000 (UTC) for IP:'163.53.93.243' DOMAIN:'sender2-op-o12.zoho.com.cn' HELO:'sender1.zoho.com.cn' FROM:'fam@euphon.net' RCPT:'' X-RedHat-Spam-Score: -0.101 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, SPF_PASS) 163.53.93.243 sender2-op-o12.zoho.com.cn 163.53.93.243 sender2-op-o12.zoho.com.cn X-Scanned-By: MIMEDefang 2.84 on 10.5.110.49 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: patchew-devel@redhat.com Cc: Fam Zheng Subject: [Patchew-devel] [PATCH v2 06/12] Add "Watch query" button to search result 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 28 Nov 2018 14:36:22 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Fam Zheng This button will update the search query used to automatically populate the user's 'watched' queue. Signed-off-by: Fam Zheng --- mods/maintainer.py | 17 +++++++++++++++++ www/templates/series-list.html | 8 ++++++++ 2 files changed, 25 insertions(+) diff --git a/mods/maintainer.py b/mods/maintainer.py index 541d6f3..54738ec 100644 --- a/mods/maintainer.py +++ b/mods/maintainer.py @@ -100,6 +100,22 @@ class MaintainerModule(PatchewModule): self._drop_from_queue(request.user, m, queue) return HttpResponseRedirect(request.META.get('HTTP_REFERER')) =20 + 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 and q.query =3D=3D context_data.get("search"): + context_data["is_watched_query"] =3D True + + def www_view_watch_query(self, request): + if not request.user.is_authenticated: + raise PermissionDenied() + query =3D request.GET.get("q") + if not query: + return HttpResponseBadRequest("Invalid query") + WatchedQuery.objects.update_or_create(defaults=3D{"query": query}, + user=3Drequest.user) + return HttpResponseRedirect(request.META.get('HTTP_REFERER')) + def www_url_hook(self, urlpatterns): urlpatterns.append(url(r"^mark-as-merged/(?P.*)/", self.www_view_mark_as_merged, @@ -122,6 +138,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"^watch-query/", self.www_view_watch_query= )) =20 def prepare_message_hook(self, request, message, detailed): if not detailed or not request.user.is_authenticated: diff --git a/www/templates/series-list.html b/www/templates/series-list.html index 8a29f98..6c77d47 100644 --- a/www/templates/series-list.html +++ b/www/templates/series-list.html @@ -74,6 +74,14 @@ {% endif %} =20 +{% if is_search %} + {% if is_watched_query %} +

Saved as my watched query

+ {% else %} + + {% endif %} +{% endif %} +