From patchwork Tue Jun 4 21:31:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 1110172 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45JQ9Z055qz9s4V for ; Wed, 5 Jun 2019 07:32:02 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="ExJ2Ij1W"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 45JQ9Y12MZzDqWG for ; Wed, 5 Jun 2019 07:32:01 +1000 (AEST) X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=bombadil.srs.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=batv+7243a8a963bcae4fad07+5763+infradead.org+mchehab@bombadil.srs.infradead.org; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="ExJ2Ij1W"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 45JQ9L42JyzDqV8 for ; Wed, 5 Jun 2019 07:31:46 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: Content-Type:MIME-Version:Message-ID:Subject:To:From:Date:Sender:Reply-To:Cc: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ts0x6yYNDvmy8Vebv4nJWYjvKybtUYQlL+DUnHGwBpg=; b=ExJ2Ij1W38pcomRCX4qSOWR9W kZKEaz1sKF+K66GdzPdUcm8EdQ1tC6FBj9XoW2GEj/cZKUna3uKlx3n2upQnxOh3DJt3KpUbM2vyd PpElV5QdjJnixFJ2U7Bs25kd3I28Fnvqp8FQ9ya+XsySSc0KsdAd1MtqxG7w2eJkgb9yoFbWBCDVS brxIZrk49r240ZD94fo6Chd8oOI0ggZC0I17jzYBYrD1bO+u7p8TJTvLHzqCdnh6piw4EMJBoqX2K eaMKmV/bsLjv5RbDI7AW4WPtRoj0PiOtJ/70V+hw0vLgKGOvdOQynylpONghAqW7IqAVDFS8e/lWi Blf19Wdsw==; Received: from [179.182.172.34] (helo=coco.lan) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hYH1y-0008PT-Bt for patchwork@lists.ozlabs.org; Tue, 04 Jun 2019 21:31:42 +0000 Date: Tue, 4 Jun 2019 18:31:39 -0300 From: Mauro Carvalho Chehab To: patchwork@lists.ozlabs.org Subject: Fw: [PATCH v2] filters: re-add the possibility of filtering undelegated patches Message-ID: <20190604183139.4909299f@coco.lan> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" Forwarded message: Date: Tue, 4 Jun 2019 15:07:58 -0300 From: Mauro Carvalho Chehab To: patchwork@lists.ozlabs.org Subject: [PATCH v2] filters: re-add the possibility of filtering undelegated patches The filters.py redesign that happened for patchwork 1.1 removed a functionality that we use a lot: to filter patches that weren't delegated to anyone. Also, it is a way harder to find someone to delegate with a free text input. Use, instead a combo-box just like before. Signed-off-by: Mauro Carvalho Chehab Thanks, Mauro Thanks, Mauro diff --git a/patchwork/filters.py b/patchwork/filters.py index 79aaea437c6e..11d00390145a 100644 --- a/patchwork/filters.py +++ b/patchwork/filters.py @@ -385,6 +385,7 @@ class ArchiveFilter(Filter): class DelegateFilter(Filter): name = 'Delegate' param = 'delegate' + no_delegate_str = 'Nobody' ANY_DELEGATE = object() def __init__(self, filters): @@ -416,6 +417,11 @@ class DelegateFilter(Filter): if not key: return + if key == self.no_delegate_str: + self.delegate_match = key + self.applied = True + return + try: self.delegate = User.objects.get(id=int(key)) except (ValueError, User.DoesNotExist): @@ -436,6 +442,9 @@ class DelegateFilter(Filter): if self.delegate: return {'delegate': self.delegate} + if self.delegate_match == self.no_delegate_str: + return {'delegate__username__isnull': True} + if self.delegate_match: return {'delegate__username__icontains': self.delegate_match} @@ -447,8 +456,33 @@ class DelegateFilter(Filter): return mark_safe('%s' % ( self.param, self.condition)) - return mark_safe('') + delegates = User.objects.filter(profile__maintainer_projects__isnull = False) + + str = '' + + return mark_safe(str) def set_status(self, *args, **kwargs): if 'delegate' in kwargs: diff --git a/patchwork/templates/patchwork/partials/filters.html b/patchwork/templates/patchwork/partials/filters.html index 41ed2c268e46..e89c4d0f6284 100644 --- a/patchwork/templates/patchwork/partials/filters.html +++ b/patchwork/templates/patchwork/partials/filters.html @@ -76,44 +76,6 @@ $(document).ready(function() { }); } }); - - $('#delegate_input').selectize({ - plugins: ['enter_key_submit'], - maxItems: 1, - persist: false, - onInitialize: function() { - this.on('submit', function() { - if (!this.items.length) - this.$input.val(this.lastValue); - this.$input.closest('form').submit(); - }, this); - }, -{% if "delegate" in filters.applied_filters %} -{% with delegate_filter=filters.applied_filters.delegate %} - options: [ - { - value: "{{ delegate_filter.key }}", - text: "{{ delegate_filter.condition }}", - }, - ], - items: ["{{ delegate_filter.key }}"], -{% endwith %} -{% endif %} - load: function(query, callback) { - req = $.ajax({ - url: "{% url 'api-delegates' %}", - data: {q: query, l: 10}, - error: function() { - callback(); - }, - success: function(res) { - callback($.map(res, function (obj) { - return {value: obj.pk, text: obj.name}; - })); - } - }); - } - }); }); diff --git a/releasenotes/notes/Re-added-delegate-to-nobody-filter-and-use-select-for-delegated-people-04a81a4a914965d8.yaml b/releasenotes/notes/Re-added-delegate-to-nobody-filter-and-use-select-for-delegated-people-04a81a4a914965d8.yaml new file mode 100644 index 000000000000..eb4246e5600e --- /dev/null +++ b/releasenotes/notes/Re-added-delegate-to-nobody-filter-and-use-select-for-delegated-people-04a81a4a914965d8.yaml @@ -0,0 +1,11 @@ +--- +prelude: > + In the past, Patchwork used to support filtering patches that weren't + delegated to anyone. This feature was removed in 2015, as part of a + patch designed to support deletation to anyone. Yet, the feature didn't + scale and got removed in 2016. So, re-introduce the old logic, fixing + a regression. +fixes: + - | + Fix a regression introduced by changeset + f439f5414206 ("Add delegate filter autocomplete support")