From nobody Mon Sep 16 19:37:36 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=1645604941; cv=none; d=zohomail.com; s=zohoarc; b=UG3WPiKTERqD4cgwvTHsl2KqJ1uIiw6FMkNxZHiRmUTjZqI0CnpZYrWRKnnUUGTTxxLE8uX/FeAiVyjYvF4/kfnDNC5+5JNbijMkvSfTGXkLlAwriLcZUZAKJ0yizVaFfb+9FOjDcrGjDD/rrVQ+k199CMhLNumgk0+ohFXfvP4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1645604941; 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=EWnel3KLsP4luSOj/2nOd3Co0aUAMtT0Tstt/+SXJ3Q=; b=XUSuadFCOZdRspxlACV91zXiO/BUYYwDG6gQGs2Lh3BsQDDyUD2M4Tn6NHglpZWQ4V1eH5bJioX9ohY7YGY/cA5cAwlr/s1//8cUwxzA9JA4Brnd4x5FuEeTY9U8mz7/7HJl+QYjrnPfFLQBWnpbLTWiFuVRSovINLTZKMw9FBo= 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 1645604941717393.3770747522518; Wed, 23 Feb 2022 00:29:01 -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-341-pSO7oMtgO4OKqn87idaDBQ-1; Wed, 23 Feb 2022 03:28:58 -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 5AD231091DA6; Wed, 23 Feb 2022 08:28:57 +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 51CEB6608C; Wed, 23 Feb 2022 08:28:57 +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 4A0A94ED66; Wed, 23 Feb 2022 08:28:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 21N8QieX028042 for ; Wed, 23 Feb 2022 03:26:45 -0500 Received: by smtp.corp.redhat.com (Postfix) id B9B941121339; Wed, 23 Feb 2022 08:26:44 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B43671121334 for ; Wed, 23 Feb 2022 08:26:41 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6809610AF953 for ; Wed, 23 Feb 2022 08:26:41 +0000 (UTC) Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-22-T6QHAxb5P_if07PcySF2Xw-2; Wed, 23 Feb 2022 03:26:39 -0500 Received: by mail-ed1-f52.google.com with SMTP id z22so42910327edd.1 for ; Wed, 23 Feb 2022 00:26:39 -0800 (PST) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id s18sm334929eja.87.2022.02.23.00.26.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 00:26:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645604939; 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=EWnel3KLsP4luSOj/2nOd3Co0aUAMtT0Tstt/+SXJ3Q=; b=CHY1RCJeFxn+4QkfQ2xfFr7yaOrKg1n+B9Fe7l6rNtHQGs6vrEXcZv0e0iqyjUvXa8WHny XfhvDAnn3kKTMtRn9AWQPSRJ0z+CFcQU7/Tig8W/+OLvJfum1qaONkn4avv9Db1lgwRd9H R2UqeYgR1U85DDuUjSmzPyVRs8y8csM= X-MC-Unique: pSO7oMtgO4OKqn87idaDBQ-1 X-MC-Unique: T6QHAxb5P_if07PcySF2Xw-2 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=33oLJVFSxNqz87AN65aYXvdqWVW9MbM5z2THLhAX2xc=; b=xyukHoRUk4lTi8bJF3iYNdCEpY3o67oqAaDzCtgLZKZt0s37Ju5wiVPCEENBi0UJwC 1SuWBvGiI2czStxql/+1EbHvThivp9HeadbT2VdGIWlDgO8fYJagcfSBdK038S54CHSu T9jRa/A6xv8YF/oqPK0eHlPOudsJ27xFwEsGc8rJhzA9Mmnu9DbuoflhLl11hE1SK59R 7au87oW/3/9MqwJwGADOwoNUU3ZsegGCtdsjZ5F0jRUUt/FIyu97c4UHHz/UbyZM7RcB fq++H5vgJZURG9bFeaY5vwL9GM8r3JXGwrtuzPAknxvIBipVWbn1uqvhE1HJMJaInz0i hDUA== X-Gm-Message-State: AOAM530A74n0I8JkMTpggbLtVKcq7VULNERC/35IUVMfd1xQM2bYR814 jX/iPutGS0bFJUImSH/+yC9ns4IUTgY= X-Google-Smtp-Source: ABdhPJyEcm4jDrhtUFKhjXFA8mLSqGyf0dkKlKjTqKBXZXX63EvkOjpK9FwydpaurUVQ8VdsaD9Irg== X-Received: by 2002:a05:6402:c10:b0:40f:33cd:a39 with SMTP id co16-20020a0564020c1000b0040f33cd0a39mr30000186edb.234.1645604798390; Wed, 23 Feb 2022 00:26:38 -0800 (PST) From: Paolo Bonzini To: patchew-devel@redhat.com Date: Wed, 23 Feb 2022 09:26:31 +0100 Message-Id: <20220223082631.228937-7-pbonzini@redhat.com> In-Reply-To: <20220223082631.228937-1-pbonzini@redhat.com> References: <20220223082631.228937-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH 6/6] search, maintainer: allow "xxx:me" terms in watched queries 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: 1645604943935100005 Content-Type: text/plain; charset="utf-8" Signed-off-by: Paolo Bonzini --- api/search.py | 4 ++-- mods/maintainer.py | 2 +- tests/test_maintainers.py | 22 ++++++++++++++++++++++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/api/search.py b/api/search.py index 08b40c3..2e43421 100644 --- a/api/search.py +++ b/api/search.py @@ -427,7 +427,7 @@ Search text keyword in the email message. Example: =20 return queryset.filter(q) =20 - def query_test_message(self, query, message): + def query_test_message(self, query, message, user=3DNone): queryset =3D Message.objects.filter(id=3Dmessage.id) terms =3D [x.strip() for x in query.split() if x.strip()] - return self.search_series(*terms, queryset=3Dqueryset).first() + return self.search_series(*terms, user=3Duser, queryset=3Dqueryset= ).first() diff --git a/mods/maintainer.py b/mods/maintainer.py index c246d8a..966eb05 100644 --- a/mods/maintainer.py +++ b/mods/maintainer.py @@ -69,7 +69,7 @@ class MaintainerModule(PatchewModule): def _update_watch_queue(self, series): se =3D SearchEngine() for wq in WatchedQuery.objects.all(): - if se.query_test_message(wq.query, series): + if se.query_test_message(wq.query, series, wq.user): self._add_to_queue(wq.user, series, "watched") else: self._drop_from_queue(wq.user, series, "watched") diff --git a/tests/test_maintainers.py b/tests/test_maintainers.py index 91ad044..5f1fcc5 100755 --- a/tests/test_maintainers.py +++ b/tests/test_maintainers.py @@ -88,6 +88,28 @@ class MaintainerQueueTest(PatchewTestCase): assert q assert q.message.id =3D=3D msg.id =20 + def test_update_watch_with_user_me(self): + wq =3D WatchedQuery(user=3Dself.testuser, query=3D"to:qemu-block@n= ongnu.org -nack:me") + wq.save() + self.cli_import("0001-simple-patch.mbox.gz") + msg =3D Message.objects.first() + query =3D QueuedSeries.objects.filter(user=3Dself.testuser, name= =3D"watched") + q =3D query.first() + assert q + assert q.message.id =3D=3D msg.id + + # TODO: support and use REST API + self.client.post("/login/", {"username": "test", "password": "1234= "}) + self.client.get("/mark-as-rejected/" + msg.message_id + "/") + query =3D QueuedSeries.objects.filter(user=3Dself.testuser, name= =3D"reject") + q =3D query.first() + assert q + assert q.message.id =3D=3D msg.id + + query =3D QueuedSeries.objects.filter(user=3Dself.testuser, name= =3D"watched") + q =3D query.first() + assert not q + =20 if __name__ =3D=3D "__main__": main() --=20 2.34.1 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://listman.redhat.com/mailman/listinfo/patchew-devel