-
Notifications
You must be signed in to change notification settings - Fork 44
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Package version (if known): present in 4.1.2
Describe the bug
I noticed that requests_service.search() does not correctly handle some parameters including 'type' and 'status' to filter the search. Searching with these parameters has no effect, meaning that unwanted requests are returned.
Steps to Reproduce
In an running instance's flask shell -
- Use requests_search without these parameters, eg:
In [117]: foo=rs.search(system_identity, receiver={"user": "7"}, topic={"community":"988b42c2-9dc8-4b88-8f79-921d59cde71c"}).to_dict()['hits']['hits']
In [118]: foo
Out[118]:
[{'id': '02a6b08d-3b39-4ca3-b8c2-d920381280fe',
'created': '2025-01-28T09:37:06.619302+00:00',
'updated': '2025-01-28T09:37:08.412501+00:00',
'links': {'actions': {},
'self': 'https://12test0.dev.hasdai.org/api/requests/02a6b08d-3b39-4ca3-b8c2-d920381280fe',
'self_html': 'https://12test0.dev.hasdai.org/requests/02a6b08d-3b39-4ca3-b8c2-d920381280fe',
'comments': 'https://12test0.dev.hasdai.org/api/requests/02a6b08d-3b39-4ca3-b8c2-d920381280fe/comments',
'timeline': 'https://12test0.dev.hasdai.org/api/requests/02a6b08d-3b39-4ca3-b8c2-d920381280fe/timeline'},
'revision_id': 3,
'type': 'community-invitation',
'title': 'Invitation to join "group b"',
'description': 'You will join as "Reader".',
'number': '1h',
'status': 'accepted',
'is_closed': True,
'is_open': False,
'expires_at': '2025-02-27T09:37:06.608235+00:00',
'is_expired': False,
'created_by': {'community': '988b42c2-9dc8-4b88-8f79-921d59cde71c'},
'receiver': {'user': '7'},
'topic': {'community': '988b42c2-9dc8-4b88-8f79-921d59cde71c'}}]- Note there is a single request of type 'community-invitation' for this user/community.
- Do another search that should exclude this one - for example type='review-request'
In [119]: foo=rs.search(system_identity, receiver={"user": "7"}, topic={"community":"988b42c2-9dc8-4b88-8f79-921d59cde71c"}, type="review-request").to_dict()['hits']['hits']
In [120]: foo
Out[120]:
[{'id': '02a6b08d-3b39-4ca3-b8c2-d920381280fe',
'created': '2025-01-28T09:37:06.619302+00:00',
'updated': '2025-01-28T09:37:08.412501+00:00',
'links': {'actions': {},
'self': 'https://12test0.dev.hasdai.org/api/requests/02a6b08d-3b39-4ca3-b8c2-d920381280fe',
'self_html': 'https://12test0.dev.hasdai.org/requests/02a6b08d-3b39-4ca3-b8c2-d920381280fe',
'comments': 'https://12test0.dev.hasdai.org/api/requests/02a6b08d-3b39-4ca3-b8c2-d920381280fe/comments',
'timeline': 'https://12test0.dev.hasdai.org/api/requests/02a6b08d-3b39-4ca3-b8c2-d920381280fe/timeline'},
'revision_id': 3,
'type': 'community-invitation',
'title': 'Invitation to join "group b"',
'description': 'You will join as "Reader".',
'number': '1h',
'status': 'accepted',
'is_closed': True,
'is_open': False,
'expires_at': '2025-02-27T09:37:06.608235+00:00',
'is_expired': False,
'created_by': {'community': '988b42c2-9dc8-4b88-8f79-921d59cde71c'},
'receiver': {'user': '7'},
'topic': {'community': '988b42c2-9dc8-4b88-8f79-921d59cde71c'}}]- This search should return 0 requests, however the (unwanted) community-invite is still present.
- I have verifed the
statusparameter is also ignored in the same way.topicandrecieverwork as expected.
Expected behavior
requests_search() should allow filtering on these parameters. Filtering by type is tested in invenio-communities (and probably elsewhere):
However it looks to me like this test only passes because no other requests exist in the test enviroment.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working