From nobody Tue Apr 23 18:36:23 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 1542766144518280.2216826897584; Tue, 20 Nov 2018 18:09:04 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C83B35AFF5; Wed, 21 Nov 2018 02:09:03 +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 B9255600C3; Wed, 21 Nov 2018 02:09:03 +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 AA04E181B9E1; Wed, 21 Nov 2018 02:09:03 +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 wAL291TL005998 for ; Tue, 20 Nov 2018 21:09:01 -0500 Received: by smtp.corp.redhat.com (Postfix) id C6BDE6607E; Wed, 21 Nov 2018 02:09:01 +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 EE9B366077; Wed, 21 Nov 2018 02:08:57 +0000 (UTC) From: Fam Zheng To: patchew-devel@redhat.com Date: Wed, 21 Nov 2018 10:08:31 +0800 Message-Id: <20181121020846.7875-2-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 01/16] models: Add project name to Message __str__ 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 21 Nov 2018 02:09:03 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Fam Zheng Message-Id: <20181116060948.25592-2-famz@redhat.com> Reviewed-by tags etc. from replies now trigge retesting and in turn resendi= ng Signed-off-by: Fam Zheng Reviewed-by tags etc. from replies now trigge retesting and in turn resendi= ng --- api/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/models.py b/api/models.py index b42be53..ea3b654 100644 --- a/api/models.py +++ b/api/models.py @@ -718,7 +718,7 @@ class Message(models.Model): return MessageResult(message=3Dself, **kwargs) =20 def __str__(self): - return self.subject + return self.project.name + "/" + self.subject =20 class Meta: unique_together =3D ('project', 'message_id',) --=20 2.17.2 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel From nobody Tue Apr 23 18:36:23 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 1542766150664683.9158476556112; Tue, 20 Nov 2018 18:09:10 -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 B134B308FB94; Wed, 21 Nov 2018 02:09:09 +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 A2C51662D2; Wed, 21 Nov 2018 02:09:09 +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 99AC9181B9E3; Wed, 21 Nov 2018 02:09:09 +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 wAL298gR006016 for ; Tue, 20 Nov 2018 21:09:08 -0500 Received: by smtp.corp.redhat.com (Postfix) id 25A1B66079; Wed, 21 Nov 2018 02:09:08 +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 6235C6607B; Wed, 21 Nov 2018 02:09:02 +0000 (UTC) From: Fam Zheng To: patchew-devel@redhat.com Date: Wed, 21 Nov 2018 10:08:32 +0800 Message-Id: <20181121020846.7875-3-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 02/16] testing: Fix bugs that new reviewed-by tags trigger retest 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.43]); Wed, 21 Nov 2018 02:09:09 +0000 (UTC) Content-Type: text/plain; charset="utf-8" New rev-by tags should only initiate a git apply, but the testing results are still valid, we don't want to rerun all tests and especially get the same error reports a second time. Signed-off-by: Fam Zheng Message-Id: <20181116060948.25592-3-famz@redhat.com> Reviewed-by tags etc. from replies now trigge retesting and in turn resendi= ng Signed-off-by: Fam Zheng Reviewed-by tags etc. from replies now trigge retesting and in turn resendi= ng --- mods/testing.py | 17 +++++---- tests/data/0025-foo-patch-review.mbox.gz | Bin 0 -> 1417 bytes tests/data/0026-bar-patch-standalone.mbox.gz | Bin 0 -> 1558 bytes tests/data/0027-foo-patch-based-on.mbox.gz | Bin 0 -> 1421 bytes tests/patchewtest.py | 5 ++- tests/test_testing.py | 38 +++++++++++++------ 6 files changed, 40 insertions(+), 20 deletions(-) create mode 100644 tests/data/0025-foo-patch-review.mbox.gz create mode 100644 tests/data/0026-bar-patch-standalone.mbox.gz create mode 100644 tests/data/0027-foo-patch-based-on.mbox.gz diff --git a/mods/testing.py b/mods/testing.py index b3e4b07..66e86b1 100644 --- a/mods/testing.py +++ b/mods/testing.py @@ -119,19 +119,16 @@ class TestingModule(PatchewModule): register_handler("ResultUpdate", self.on_result_update) =20 def on_set_property(self, evt, obj, name, value, old_value): - if ((isinstance(obj, Message) and obj.is_series_head) \ - or isinstance(obj, Project)) \ - and name in ("git.tag", "git.repo") \ - and old_value is None \ - and obj.get_property("git.tag") and obj.get_property("git.repo= "): - self.clear_and_start_testing(obj) - elif isinstance(obj, Project) and name =3D=3D "git.head" \ + if isinstance(obj, Project) and name =3D=3D "git.head" \ and old_value !=3D value: self.clear_and_start_testing(obj) elif isinstance(obj, Project) and name.startswith("testing.tests."= ) \ and old_value !=3D value: self.project_recalc_pending_tests(obj) =20 + def get_msg_base_tags(self, msg): + return [t for t in msg.tags if t.lower().startswith("based-on:")] + def on_result_update(self, evt, obj, old_status, result): if result.name.startswith("testing.") and result.status !=3D old_s= tatus: if 'tester' in result.data: @@ -141,14 +138,18 @@ class TestingModule(PatchewModule): status__in=3D(Result.PENDING, Result.RUNNING)).= exists(): obj.set_property("testing.done", True) obj.set_property("testing.tested-head", result.data["head"= ]) + if isinstance(obj, Message): + obj.set_property("testing.tested-base", + self.get_msg_base_tags(obj)) =20 if result.name !=3D "git": return if isinstance(obj, Message) \ and obj.is_series_head \ - and old_status !=3D Result.SUCCESS \ and result.status =3D=3D result.SUCCESS \ and result.data.get("tag") and result.data.get("repo"): + tested_base =3D obj.get_property("testing.tested-base") + if tested_base is None or tested_base !=3D self.get_msg_base_t= ags(obj): self.clear_and_start_testing(obj) =20 def filter_testing_results(self, queryset, *args, **kwargs): diff --git a/tests/data/0025-foo-patch-review.mbox.gz b/tests/data/0025-foo= -patch-review.mbox.gz new file mode 100644 index 0000000000000000000000000000000000000000..32171bb3179ce3fdd04c3acb150= 62b72beca9311 GIT binary patch literal 1417 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 I%D)Z(0Cyt-umAu6 literal 0 HcmV?d00001 diff --git a/tests/data/0027-foo-patch-based-on.mbox.gz b/tests/data/0027-f= oo-patch-based-on.mbox.gz new file mode 100644 index 0000000000000000000000000000000000000000..5553b2a939e46a276479b9f56f6= d485a584157dd GIT binary patch literal 1421 zcmV;81#gu%yj5{kc6nSqXO!#AFRPyj~)&ugogAk>15K$2=3DnW=3DnxKH-9LISOOsMX< z_g2;IZm}u<&N4P4y~G0^r%9Hx>`NNtVZH9 z!6=3DCXE+84hHx?IU#J;mB8774YnfxLWF%gB@1x8Hri3oBg!Jw|D>#k;)4NZ3-kdU%0 z=3D6TLWAek7k3~B)3lrxbNo_a49ya1HG3g}&_YpcYEo6-Bg1d>ZqM#fnZA8zyg_@v+A zntp2{>_dd>52sw_QhR!bbn+q-q#NXs2M52t>*r@dJW#-3V}Gb_K0a)c>epa6hj^wb z0a3WA60x%P$nyyN%U;(9J_6mc9qPDEN4E^iwGGW}8jkBW8_foF8vAgWh)-ZR@Mj@V zVciDZ^%}OP>p-YODO9_yUTq6y5(d*KkvUW!JWua?rfIv)9SYSddkArp#R4Cbah^i8 zJ>xN0nxkW2b)!V@QWJMkl!s@$X%R}PebFV?|5f(JNw#x7cF;F;&q4)Uq;FCBk~o`8 z)~bW`peo#?o^D#6iBizM*Dwu-{toeR5dZjsV;u##s_5q$EJ?X-MasB{$zL}msg*_> zt@;Wp>g;CKVnZGX!W1S%y+LvTTBbovWEcp6v-VExErs3fS>(!j7j}C$_IRdit9*-^ zG&S8cG~G2d!|i*P({zlo9NWa+Q;p{ybL|Bs|B9U7zk=3DI&wUap76k?|u{HbD@5@qj(ICcrRx9(i zpDpRQbxf(#p{~1M+3OVyWph`u(NZ=3DCKBBnjKexS;E&mBdS|M2`=3DW-+AC<;@eH;8VU znh53_A}VEUThmb;bD<3ae!H$!^j%A{>gCruqeV9q4PT#1*`tQlr0(mz&{+0DCsU_g zCy3!bVpyQ9Cab6uedmBwTBy7S+p;xP22082Vunj5WiVmn93?wY0n|2Js#}ibXgDE` zPIRJ@l3^h6G)}}u_H#jQSUR0AE*3vqzOm|#_@zaVc>GU;IeL!jE5h*|HV`u++Zai{(dfVA0E0#y_2&(d@GWyz=3DhXhItOHx@+m`gm;hO% zi*sy*S&kVKJsf8CTCd!ZOKj^Hz5Odr3r_?>(NKTA(#;Uzh~cT~El#P*h0=3D7>a3|^Tb;_;FnIa zhW!s&igZ}4QZ7LpWnqNkE&=3DSyACwXGD37OW$?MAvlriDzEf`<6_@1$8x-0T$fbkZT zE|>eiB9{7ri*fQ>YOQJ2&axzvWYbCBdX=3Dh_L+QbXReOGT-wpSU+~fUJH6pow6l%}6 zI?Bf%aWbHT-_80&<;4`PB5)A>&VT~k4{W2^G#W;u34XUX(4XGeO{y>7fbZj{-|4p0 zM;C7YF)XyV+vCO8eWyd(#~5&O?RNmKTNi*UPH)VCJ}{6AUJWgK&@h+T$yc5glK6R$ b7ZMRxD#uGdeoZA~+jsv5U0&>@2o3-M@@};e literal 0 HcmV?d00001 diff --git a/tests/patchewtest.py b/tests/patchewtest.py index d41793e..fc6de3e 100644 --- a/tests/patchewtest.py +++ b/tests/patchewtest.py @@ -101,7 +101,10 @@ class PatchewTestCase(django.test.LiveServerTestCase): self.check_cli(["import", self.get_data_path(mbox)], rc) =20 def do_apply(self): - self.cli(["apply", "--applier-mode"]) + while True: + r, out, err =3D self.cli(["apply", "--applier-mode"]) + if r !=3D 0: + break for s in Message.objects.series_heads(): self.assertNotEqual(s.git_result.status, Result.PENDING) =20 diff --git a/tests/test_testing.py b/tests/test_testing.py index 6e960f1..6f2808c 100755 --- a/tests/test_testing.py +++ b/tests/test_testing.py @@ -260,20 +260,36 @@ class TesterTest(PatchewTestCase): self.assertNotIn("Project: DENY\n", out) self.cli_logout() =20 - def test_tester_single(self): - self.cli_login() - out, err =3D self.check_cli(["tester", "-p", "QEMU,UMEQ,ALLOW,DENY= ", - "--no-wait", "-N", "1"]) - self.assertIn("Project: QEMU\n", out) - out, err =3D self.check_cli(["tester", "-p", "QEMU,UMEQ,ALLOW,DENY= ", - "--no-wait", "-N", "1"]) - self.assertIn("Project: UMEQ\n", out) - out, err =3D self.check_cli(["tester", "-p", "QEMU,UMEQ,ALLOW,DENY= ", - "--no-wait", "-N", "1"]) - self.assertIn("Project: ALLOW\n", out) + def verify_tests(self, projects): + if projects: + out, err =3D self.check_cli(["tester", "-p", "QEMU,UMEQ,ALLOW,= DENY", + "--no-wait", "-N", str(len(projects= ))]) + for p in projects: + self.assertIn("Project: %s" % p, out) out, err =3D self.check_cli(["tester", "-p", "QEMU,UMEQ,ALLOW,DENY= ", "--no-wait", "-N", "1"]) self.assertIn("Nothing to test", out) + + def test_tester_single(self): + self.cli_login() + + self.verify_tests(["QEMU", "UMEQ", "ALLOW"]) + self.do_apply() + self.verify_tests(["QEMU", "UMEQ", "ALLOW"]) + # Getting a new reviewed-by shouldn't trigger re-test + self.cli_import('0025-foo-patch-review.mbox.gz') + self.do_apply() + self.verify_tests([]) + + # Import a new series to rebase onto + self.cli_import('0026-bar-patch-standalone.mbox.gz') + self.do_apply() + self.verify_tests(["QEMU", "UMEQ", "ALLOW"]) + + self.cli_import('0027-foo-patch-based-on.mbox.gz') + self.do_apply() + self.verify_tests(["QEMU", "UMEQ", "ALLOW"]) + self.cli_logout() =20 def test_tester_project(self): --=20 2.17.2 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel From nobody Tue Apr 23 18:36:23 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 154276617675959.98683523283705; Tue, 20 Nov 2018 18:09:36 -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 129513082A2F; Wed, 21 Nov 2018 02:09:36 +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 0401F18A53; Wed, 21 Nov 2018 02:09:36 +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 EDD5B3F953; Wed, 21 Nov 2018 02:09:35 +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 wAL29LgO006034 for ; Tue, 20 Nov 2018 21:09:21 -0500 Received: by smtp.corp.redhat.com (Postfix) id B3AEA66079; Wed, 21 Nov 2018 02:09:21 +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 4322066082; Wed, 21 Nov 2018 02:09:08 +0000 (UTC) From: Fam Zheng To: patchew-devel@redhat.com Date: Wed, 21 Nov 2018 10:08:33 +0800 Message-Id: <20181121020846.7875-4-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 03/16] mod: Pass request in render_page_hook 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.45]); Wed, 21 Nov 2018 02:09:36 +0000 (UTC) Content-Type: text/plain; charset="utf-8" This will be useful soon to extract information from the request useful to generate mod content. Signed-off-by: Fam Zheng --- mods/footer.py | 2 +- www/views.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/footer.py b/mods/footer.py index a947253..048bbcb 100644 --- a/mods/footer.py +++ b/mods/footer.py @@ -30,6 +30,6 @@ The config is the raw HTML code to inject. name =3D "footer" default_config =3D _default_config =20 - def render_page_hook(self, context_data): + def render_page_hook(self, request, context_data): context_data.setdefault("footer", "") context_data["footer"] +=3D self.get_config_raw() diff --git a/www/views.py b/www/views.py index 49357e2..5927e61 100644 --- a/www/views.py +++ b/www/views.py @@ -36,7 +36,7 @@ def try_get_git_head(): =20 def render_page(request, template_name, **data): data["patchew_version"] =3D settings.VERSION + try_get_git_head() - dispatch_module_hook("render_page_hook", context_data=3Ddata) + dispatch_module_hook("render_page_hook", request=3Drequest, context_da= ta=3Ddata) return render(request, template_name, context=3Ddata) =20 =20 --=20 2.17.2 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel From nobody Tue Apr 23 18:36:23 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 1542766189679248.56949141094378; Tue, 20 Nov 2018 18:09:49 -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 F156C5AFF5; Wed, 21 Nov 2018 02:09:48 +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 E296B5D9CB; Wed, 21 Nov 2018 02:09: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 D79913F7CB; Wed, 21 Nov 2018 02:09:48 +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 wAL29Q8E006046 for ; Tue, 20 Nov 2018 21:09:26 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7F5696608F; Wed, 21 Nov 2018 02:09:26 +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 690DA66077; Wed, 21 Nov 2018 02:09:22 +0000 (UTC) From: Fam Zheng To: patchew-devel@redhat.com Date: Wed, 21 Nov 2018 10:08:34 +0800 Message-Id: <20181121020846.7875-5-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 04/16] template: Simpify op.icon default 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.39]); Wed, 21 Nov 2018 02:09:49 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Fam Zheng --- www/templates/series-detail.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/templates/series-detail.html b/www/templates/series-detail= .html index 02ce72c..c7b7f1d 100644 --- a/www/templates/series-detail.html +++ b/www/templates/series-detail.html @@ -40,7 +40,7 @@ --=20 2.17.2 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel From nobody Tue Apr 23 18:36:23 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 1542766182977713.6134108122204; Tue, 20 Nov 2018 18:09:42 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 40DBD2D2BC8; Wed, 21 Nov 2018 02:09:42 +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 319945D73F; Wed, 21 Nov 2018 02:09:42 +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 283E53F953; Wed, 21 Nov 2018 02:09:42 +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 wAL29Xie006059 for ; Tue, 20 Nov 2018 21:09:33 -0500 Received: by smtp.corp.redhat.com (Postfix) id 117CB6607E; Wed, 21 Nov 2018 02:09:33 +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 E925A66079; Wed, 21 Nov 2018 02:09:26 +0000 (UTC) From: Fam Zheng To: patchew-devel@redhat.com Date: Wed, 21 Nov 2018 10:08:35 +0800 Message-Id: <20181121020846.7875-6-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 05/16] Generalize Review model to Queue 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 21 Nov 2018 02:09:42 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The concept of a queue is a per-user model for maintainers. A maintainer can have one ore more queues. The current Review model already has accept and reject stautus, so we generalize that to support a more flexible queue feature. Previously, "mark as accepted" adds a (user, message, accept=3DTrue) record in the Review model. Now it adds a (user, message, name=3D'accept') record in the Queue model. Similary, for 'mark as rejected', a (user, message, name=3D'reject') record is added in the Queue model. This makes the two queue names specially purposed on the web interface and search terms, which we'll extend to also support normal queues. Signed-off-by: Fam Zheng --- api/migrations/0040_review_to_queue.py | 19 +++++++++++ api/migrations/0041_auto_20181120_0636.py | 40 +++++++++++++++++++++++ api/models.py | 12 +++++-- api/search.py | 10 +++--- mods/maintainer.py | 23 +++++++------ 5 files changed, 86 insertions(+), 18 deletions(-) create mode 100644 api/migrations/0040_review_to_queue.py create mode 100644 api/migrations/0041_auto_20181120_0636.py diff --git a/api/migrations/0040_review_to_queue.py b/api/migrations/0040_r= eview_to_queue.py new file mode 100644 index 0000000..7ef9fc9 --- /dev/null +++ b/api/migrations/0040_review_to_queue.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.16 on 2018-11-20 06:33 +from __future__ import unicode_literals + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies =3D [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('api', '0039_fix_project_attr_help_texts'), + ] + + operations =3D [ + migrations.RenameModel('Review', 'Queue'), + ] diff --git a/api/migrations/0041_auto_20181120_0636.py b/api/migrations/004= 1_auto_20181120_0636.py new file mode 100644 index 0000000..0b91cf0 --- /dev/null +++ b/api/migrations/0041_auto_20181120_0636.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.16 on 2018-11-20 06:36 +from __future__ import unicode_literals + +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies =3D [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('api', '0040_review_to_queue'), + ] + + operations =3D [ + migrations.RenameField( + model_name=3D'message', + old_name=3D'reviews', + new_name=3D'queues', + ), + migrations.AddField( + model_name=3D'queue', + name=3D'name', + field=3Dmodels.CharField(default=3D'accept', help_text=3D'Name= of the queue', max_length=3D1024), + preserve_default=3DFalse, + ), + migrations.RemoveField( + model_name=3D'queue', + name=3D'accept', + ), + migrations.AlterUniqueTogether( + name=3D'queue', + unique_together=3Dset([('user', 'message', 'name')]), + ), + migrations.AlterIndexTogether( + name=3D'queue', + index_together=3Dset([('user', 'message')]), + ), + ] diff --git a/api/models.py b/api/models.py index ea3b654..3b57c73 100644 --- a/api/models.py +++ b/api/models.py @@ -436,11 +436,17 @@ def HeaderFieldModel(**args): return models.CharField(max_length=3D4096, **args) =20 =20 -class Review(models.Model): +class Queue(models.Model): user =3D models.ForeignKey(User) message =3D models.ForeignKey('Message') - accept =3D models.BooleanField() + # Special purposed queues: + # accept: When user marked series as "accepted" + # reject: When user marked series as "rejected" + name =3D models.CharField(max_length=3D1024, help_text=3D"Name of the = queue") =20 + class Meta: + unique_together =3D ('user', 'message', 'name') + index_together =3D [('user', 'message')] =20 class Message(models.Model): """ Patch email message """ @@ -479,7 +485,7 @@ class Message(models.Model): # number of patches we've got if is_series_head num_patches =3D models.IntegerField(null=3DFalse, default=3D-1, blank= =3DTrue) =20 - reviews =3D models.ManyToManyField(User, blank=3DTrue, through=3DRevie= w) + queues =3D models.ManyToManyField(User, blank=3DTrue, through=3DQueue) =20 objects =3D MessageManager() =20 diff --git a/api/search.py b/api/search.py index 9b41641..6942ef0 100644 --- a/api/search.py +++ b/api/search.py @@ -8,7 +8,7 @@ # This work is licensed under the MIT License. Please see the LICENSE fil= e or # http://opensource.org/licenses/MIT. =20 -from .models import Message, MessageProperty, MessageResult, Result, Review +from .models import Message, MessageProperty, MessageResult, Result, Queue from functools import reduce from django.db.models import Q =20 @@ -247,7 +247,7 @@ Search text keyword in the email message. Example: q =3D Q(user=3Duser, **kwargs) else: q =3D Q(user__username=3Dusername, **kwargs) - return self._make_filter_subquery(Review, q) + return self._make_filter_subquery(Queue, q) =20 def _make_filter(self, term, user): if term.startswith("age:"): @@ -292,13 +292,13 @@ Search text keyword in the email message. Example: return self._make_filter_result(term[8:], status=3DResult.RUNN= ING) elif term.startswith("ack:") or term.startswith("accept:") or term= .startswith("accepted:"): username =3D term[term.find(":") + 1:] - return self._make_filter_review(username, user, accept=3DTrue) + return self._make_filter_review(username, user, name=3D"accept= ") elif term.startswith("nack:") or term.startswith("reject:") or ter= m.startswith("rejected:"): username =3D term[term.find(":") + 1:] - return self._make_filter_review(username, user, accept=3DFalse) + return self._make_filter_review(username, user, name=3D"reject= ") elif term.startswith("review:") or term.startswith("reviewed:"): username =3D term[term.find(":") + 1:] - return self._make_filter_review(username, user) + return self._make_filter_review(username, user, name=3D"accept= ") elif term.startswith("project:"): cond =3D term[term.find(":") + 1:] self._projects.add(cond) diff --git a/mods/maintainer.py b/mods/maintainer.py index a3874de..7f4f5fe 100644 --- a/mods/maintainer.py +++ b/mods/maintainer.py @@ -12,7 +12,7 @@ from django.conf.urls import url from django.http import Http404, HttpResponseRedirect from django.urls import reverse from mod import PatchewModule -from api.models import Message, Review +from api.models import Message, Queue =20 class MaintainerModule(PatchewModule): """ Project maintainer related tasks """ @@ -25,8 +25,12 @@ class MaintainerModule(PatchewModule): msg =3D Message.objects.find_series(message_id) if not msg: raise Http404("Series not found") - Review.objects.update_or_create(user=3Drequest.user, message=3Dmsg, - defaults =3D { 'accept': accept }) + if accept: + to_create, to_delete =3D 'accept', 'reject' + else: + to_create, to_delete =3D 'reject', 'accept' + Queue.objects.filter(user=3Drequest.user, message=3Dmsg, name=3Dto= _delete).delete() + Queue.objects.get_or_create(user=3Drequest.user, message=3Dmsg, na= me=3Dto_create) return HttpResponseRedirect(request.META.get('HTTP_REFERER')) =20 def _delete_review(self, request, message_id): @@ -35,7 +39,8 @@ class MaintainerModule(PatchewModule): msg =3D Message.objects.find_series(message_id) if not msg: raise Http404("Series not found") - r =3D Review.objects.filter(user=3Drequest.user, message=3Dmsg) + r =3D Queue.objects.filter(user=3Drequest.user, message=3Dmsg, + name__in=3D['accept', 'reject']) r.delete() return HttpResponseRedirect(request.META.get('HTTP_REFERER')) =20 @@ -96,11 +101,9 @@ class MaintainerModule(PatchewModule): "icon": "check", "title": "Mark series as merged"= }) =20 - try: - r =3D Review.objects.get(user=3Drequest.user, message=3Dmessag= e) - except Review.DoesNotExist: - r =3D None - if r and r.accept: + r =3D Queue.objects.filter(user=3Drequest.user, message=3Dmessage, + name__in=3D['accept', 'reject']).first() + if r and r.name =3D=3D 'accept': message.extra_status.append({ "icon": "fa-check", "html": 'The series is marked for merging' @@ -112,7 +115,7 @@ class MaintainerModule(PatchewModule): "icon": "check", "title": "Mark series as accepte= d"}) =20 - if r and not r.accept: + if r and r.name =3D=3D 'reject': message.extra_status.append({ "icon": "fa-times", "html": 'The series is marked as rejected' --=20 2.17.2 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel From nobody Tue Apr 23 18:36:23 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 1542766181948890.827495300414; Tue, 20 Nov 2018 18:09:41 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 41461811D9; Wed, 21 Nov 2018 02:09:41 +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 356C55885A; Wed, 21 Nov 2018 02:09:41 +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 2AA773F953; Wed, 21 Nov 2018 02:09:41 +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 wAL29d6h006082 for ; Tue, 20 Nov 2018 21:09:39 -0500 Received: by smtp.corp.redhat.com (Postfix) id 52AE666079; Wed, 21 Nov 2018 02:09:39 +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 B05F266077; Wed, 21 Nov 2018 02:09:33 +0000 (UTC) From: Fam Zheng To: patchew-devel@redhat.com Date: Wed, 21 Nov 2018 10:08:36 +0800 Message-Id: <20181121020846.7875-7-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 06/16] maintainer: Queue operations in extra ops 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 21 Nov 2018 02:09:41 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Aside 'review' and 'reject' we add operations to add and drop whole series from/to ustom queues. Initially a "add to new queue..." link is shown in the extra ops menu, which prompts for a queue name before creating and adding the current series there. Implementing the prompt takes a little enhancement to the HTML js. Once added to a queue, the series will show a new op "drop from queue '...'". A convenient op will show in the ops, "add to queue 'foo'", if the user has previously created and added some other series. This saves typing the queue name. Signed-off-by: Fam Zheng --- mods/maintainer.py | 156 +++++++++++++++++++++++-------- www/templates/series-detail.html | 30 +++++- 2 files changed, 145 insertions(+), 41 deletions(-) diff --git a/mods/maintainer.py b/mods/maintainer.py index 7f4f5fe..d5d7c8c 100644 --- a/mods/maintainer.py +++ b/mods/maintainer.py @@ -8,17 +8,31 @@ # This work is licensed under the MIT License. Please see the LICENSE fil= e or # http://opensource.org/licenses/MIT. =20 +import re from django.conf.urls import url -from django.http import Http404, HttpResponseRedirect +from django.http import Http404, HttpResponseRedirect, HttpResponseBadRequ= est from django.urls import reverse from mod import PatchewModule -from api.models import Message, Queue +from api.models import Message, Queue, WatchedQuery =20 class MaintainerModule(PatchewModule): """ Project maintainer related tasks """ =20 name =3D "maintainer" =20 + def _add_to_queue(self, user, m, queue): + for x in [m] + list(m.get_patches()): + q, created =3D Queue.objects.get_or_create(user=3Duser, messag= e=3Dx, name=3Dqueue) + if created: + emit_event("MessageQueued", message=3Dx, queue=3Dq) + + def _drop_from_queue(self, user, m, queue): + query =3D Queue.objects.filter(user=3Duser, message__in=3Dm.get_pa= tches() + [m], + name=3Dqueue) + for q in query: + emit_event("MessageDropping", message=3Dq.message, queue=3Dq) + q.delete() + def _update_review_state(self, request, message_id, accept): if not request.user.is_authenticated: return HttpResponseForbidden() @@ -69,6 +83,27 @@ class MaintainerModule(PatchewModule): def www_view_clear_reviewed(self, request, message_id): return self._delete_review(request, message_id) =20 + def www_view_add_to_queue(self, request, message_id): + if not request.user.is_authenticated: + raise PermissionDenied() + m =3D Message.objects.filter(message_id=3Dmessage_id).first() + if not m: + raise Http404("Series not found") + queue =3D request.GET.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) + return HttpResponseRedirect(request.META.get('HTTP_REFERER')) + + def www_view_drop_from_queue(self, request, queue, message_id): + if not request.user.is_authenticated: + raise PermissionDenied() + m =3D Message.objects.filter(message_id=3Dmessage_id).first() + if not m: + raise Http404("Series not found") + self._drop_from_queue(request.user, m, queue) + 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, @@ -85,50 +120,91 @@ class MaintainerModule(PatchewModule): urlpatterns.append(url(r"^clear-reviewed/(?P.*)/", self.www_view_clear_reviewed, name=3D"clear-reviewed")) + urlpatterns.append(url(r"^add-to-queue/(?P.*)/", + self.www_view_add_to_queue, + name=3D"add-to-queue")) + urlpatterns.append(url(r"^drop-from-queue/(?P[^/]*)/(?P.*)/", + self.www_view_drop_from_queue, + name=3D"drop-from-queue")) =20 def prepare_message_hook(self, request, message, detailed): if not detailed or not request.user.is_authenticated: return - if message.is_series_head: - if message.is_merged: - message.extra_ops.append({"url": reverse("clear-merged", - kwargs=3D{"messag= e_id": message.message_id}), - "icon": "eraser", - "title": "Clear merged state"}) + if not message.is_series_head: + return + if message.is_merged: + message.extra_ops.append({"url": reverse("clear-merged", + kwargs=3D{"message_id= ": message.message_id}), + "icon": "eraser", + "title": "Clear merged state"}) + else: + message.extra_ops.append({"url": reverse("mark-as-merged", + kwargs=3D{"message_id= ": message.message_id}), + "icon": "check", + "title": "Mark series as merged"}) + + accepted =3D False + rejected =3D False + queues =3D [] + for r in Queue.objects.filter(user=3Drequest.user, message=3Dmessa= ge): + if r.name =3D=3D 'accept': + message.extra_status.append({ + "icon": "fa-check", + "html": 'The series is marked for merging' + }) + accepted =3D True + elif r.name =3D=3D 'reject': + message.extra_status.append({ + "icon": "fa-times", + "html": 'The series is marked as rejected' + }) + rejected =3D True else: - message.extra_ops.append({"url": reverse("mark-as-merged", - kwargs=3D{"messag= e_id": message.message_id}), - "icon": "check", - "title": "Mark series as merged"= }) - - r =3D Queue.objects.filter(user=3Drequest.user, message=3Dmessage, - name__in=3D['accept', 'reject']).first() - if r and r.name =3D=3D 'accept': - message.extra_status.append({ - "icon": "fa-check", - "html": 'The series is marked for merging' - }) - else: - if message.is_series_head: - message.extra_ops.append({"url": reverse("mark-as-accepted= ", - kwargs=3D{"messag= e_id": message.message_id}), - "icon": "check", - "title": "Mark series as accepte= d"}) - - if r and r.name =3D=3D 'reject': - message.extra_status.append({ - "icon": "fa-times", - "html": 'The series is marked as rejected' - }) - else: - if message.is_series_head: - message.extra_ops.append({"url": reverse("mark-as-rejected= ", - kwargs=3D{"messag= e_id": message.message_id}), - "icon": "times", - "title": "Mark series as rejecte= d"}) - - if r: + queues.append(r.name) + message.extra_ops.append({ + "url": reverse("drop-from-queue", + kwargs=3D{ + "queue": r.name, + "message_id": message.message_id + }), + "icon": "remove", + "title": "Drop from queue '%s'" % r.nam= e}) + if not accepted: + message.extra_ops.append({"url": reverse("mark-as-accepted", + kwargs=3D{"message_id= ": message.message_id}), + "icon": "check", + "title": "Mark series as accepted"}) + if not rejected: + message.extra_ops.append({"url": reverse("mark-as-rejected", + kwargs=3D{"message_id= ": message.message_id}), + "icon": "times", + "title": "Mark series as rejected"}) + if accepted or rejected: message.extra_ops.append({"url": reverse("clear-reviewed", kwargs=3D{"message_id= ": message.message_id}), "icon": "eraser", "title": "Clear review state"}) + + if queues: + message.extra_status.append({ + "icon": "fa-bookmark", + "html": 'The series is queued in: %s' % ', '.join(queues), + }) + for q in Queue.objects.filter(user=3Drequest.user).values("name").= distinct(): + qn =3D q["name"] + if qn in queues + ['reject', 'accept']: + continue + message.extra_ops.append({ + "url": "%s?queue=3D%s" % (\ + reverse("add-to-queue", + kwargs=3D{"message_id": message.message_id= }), + qn), + "icon": "bookmark", + "title": "Add to '%s' queue" % qn}) + + message.extra_ops.append({ + "url": reverse("add-to-queue", + kwargs=3D{"message_id": message.message_id}), + "get_prompt": {"queue": "What is the name of the new queue?" }, + "icon": "bookmark", + "title": "Add to new queue..."}) diff --git a/www/templates/series-detail.html b/www/templates/series-detail= .html index c7b7f1d..dcf7b79 100644 --- a/www/templates/series-detail.html +++ b/www/templates/series-detail.html @@ -40,11 +40,39 @@
    {% for op in series.extra_ops %}
  • + {% if op.get_prompt %} + {% for k, v in op.get_prompt.items %} + + {% endfor %} + {% endif %} {{ op.title }}
  • + {% if op.get_prompt %} + href=3D"#" + onclick=3D"prompt_and_open(this, '{{ op.url }}')" + {% else %} + href=3D"{{ op.url }}" + {% endif %}">{{ op.title }} {% endfor %}
+ {% endif %} =20
--=20 2.17.2 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel From nobody Tue Apr 23 18:36:23 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 1542766189704918.2471590584812; Tue, 20 Nov 2018 18:09:49 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id 07F91308FB94; Wed, 21 Nov 2018 02:09:49 +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 EED59608C4; Wed, 21 Nov 2018 02:09: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 E54BA3F7D0; Wed, 21 Nov 2018 02:09:48 +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 wAL29hWf006093 for ; Tue, 20 Nov 2018 21:09:43 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6773866083; Wed, 21 Nov 2018 02:09:43 +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 E981966077; Wed, 21 Nov 2018 02:09:39 +0000 (UTC) From: Fam Zheng To: patchew-devel@redhat.com Date: Wed, 21 Nov 2018 10:08:37 +0800 Message-Id: <20181121020846.7875-8-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 07/16] model: Introduce WatchedQuery 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 21 Nov 2018 02:09:49 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Every user can have a record in WatchedQuery. The query in this record is going to be run against every new series, and if matched, the patches will be added to the 'watched' queue, making this the 3rd specially purposed queue. Signed-off-by: Fam Zheng --- api/migrations/0042_watchedquery.py | 26 ++++++++++++++++++++++++++ api/models.py | 6 ++++++ 2 files changed, 32 insertions(+) create mode 100644 api/migrations/0042_watchedquery.py diff --git a/api/migrations/0042_watchedquery.py b/api/migrations/0042_watc= hedquery.py new file mode 100644 index 0000000..3c0fd76 --- /dev/null +++ b/api/migrations/0042_watchedquery.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.16 on 2018-11-20 10:37 +from __future__ import unicode_literals + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies =3D [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('api', '0041_auto_20181120_0636'), + ] + + operations =3D [ + migrations.CreateModel( + name=3D'WatchedQuery', + fields=3D[ + ('id', models.AutoField(auto_created=3DTrue, primary_key= =3DTrue, serialize=3DFalse, verbose_name=3D'ID')), + ('query', models.TextField(help_text=3D'Watched query')), + ('user', models.OneToOneField(on_delete=3Ddjango.db.models= .deletion.CASCADE, to=3Dsettings.AUTH_USER_MODEL)), + ], + ), + ] diff --git a/api/models.py b/api/models.py index 3b57c73..55b129e 100644 --- a/api/models.py +++ b/api/models.py @@ -442,6 +442,7 @@ class Queue(models.Model): # Special purposed queues: # accept: When user marked series as "accepted" # reject: When user marked series as "rejected" + # watched: When a series matches user's watched query name =3D models.CharField(max_length=3D1024, help_text=3D"Name of the = queue") =20 class Meta: @@ -768,3 +769,8 @@ class Module(models.Model): =20 def __str__(self): return self.name + +class WatchedQuery(models.Model): + """ User watched query """ + user =3D models.OneToOneField(User) + query =3D models.TextField(blank=3DFalse, help_text=3D"Watched query") --=20 2.17.2 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel From nobody Tue Apr 23 18:36:23 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 1542766190057852.2784194431235; Tue, 20 Nov 2018 18:09:50 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 57818C03D474; Wed, 21 Nov 2018 02:09:49 +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 48E6B19C7F; Wed, 21 Nov 2018 02:09:49 +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 3E3BB181B9E3; Wed, 21 Nov 2018 02:09:49 +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 wAL29llt006105 for ; Tue, 20 Nov 2018 21:09:47 -0500 Received: by smtp.corp.redhat.com (Postfix) id BE478608C4; Wed, 21 Nov 2018 02:09:47 +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 08A476607E; Wed, 21 Nov 2018 02:09:43 +0000 (UTC) From: Fam Zheng To: patchew-devel@redhat.com Date: Wed, 21 Nov 2018 10:08:38 +0800 Message-Id: <20181121020846.7875-9-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 08/16] 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 21 Nov 2018 02:09:49 +0000 (UTC) Content-Type: text/plain; charset="utf-8" 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 d5d7c8c..9f6f347 100644 --- a/mods/maintainer.py +++ b/mods/maintainer.py @@ -104,6 +104,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, @@ -126,6 +142,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 %} +