summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAurélien Bompard2015-12-02 12:06:06 +0100
committerBarry Warsaw2015-12-16 11:04:25 -0500
commiteedb883ced75fec3427e1f3c2cd9fc9f56cf7f6a (patch)
tree4f14b40969aa30d171bbd228148b923439c6b0b2 /src
parent85fcd4469703c2f234ed1a8554264f5d10151dcf (diff)
downloadmailman-eedb883ced75fec3427e1f3c2cd9fc9f56cf7f6a.tar.gz
mailman-eedb883ced75fec3427e1f3c2cd9fc9f56cf7f6a.tar.zst
mailman-eedb883ced75fec3427e1f3c2cd9fc9f56cf7f6a.zip
Diffstat (limited to 'src')
-rw-r--r--src/mailman/rest/sub_moderation.py19
1 files changed, 3 insertions, 16 deletions
diff --git a/src/mailman/rest/sub_moderation.py b/src/mailman/rest/sub_moderation.py
index 5d6ebce7b..2b87b0241 100644
--- a/src/mailman/rest/sub_moderation.py
+++ b/src/mailman/rest/sub_moderation.py
@@ -122,22 +122,9 @@ class SubscriptionRequests(_ModerationBase, CollectionMixin):
self._mlist = mlist
def _get_collection(self, request):
- # There's currently no better way to query the pendings database for
- # all the entries that are associated with subscription holds on this
- # mailing list. Brute force iterating over all the pendables.
- collection = []
- for token, pendable in getUtility(IPendings):
- if 'token_owner' not in pendable:
- # This isn't a subscription hold.
- continue
- list_id = pendable.get('list_id')
- if list_id != self._mlist.list_id:
- # Either there isn't a list_id field, in which case it can't
- # be a subscription hold, or this is a hold for some other
- # mailing list.
- continue
- collection.append(token)
- return collection
+ pendings = getUtility(IPendings).find(
+ mlist=self._mlist, type='subscription')
+ return [token for token, pendable in pendings]
def on_get(self, request, response):
"""/lists/listname/requests"""