mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 18:31:13 -05:00
Merge pull request #2824 from alphagov/stop-searching-to-field
Stop searching the to field
This commit is contained in:
@@ -622,7 +622,6 @@ def dao_get_notifications_by_recipient_or_reference(service_id, search_term, not
|
||||
filters = [
|
||||
Notification.service_id == service_id,
|
||||
or_(
|
||||
Notification.to.ilike("%{}%".format(search_term)),
|
||||
Notification.normalised_to.like("%{}%".format(normalised)),
|
||||
Notification.client_reference.ilike("%{}%".format(search_term)),
|
||||
),
|
||||
|
||||
@@ -1319,13 +1319,12 @@ def test_dao_get_notifications_by_reference(
|
||||
assert results[1].id == email.id
|
||||
assert results[2].id == sms.id
|
||||
|
||||
# If notification_type isn’t specified then we can’t normalise the phone number
|
||||
# to 4477… but this query will still find the 077… variant in the `to` field,
|
||||
# as well as the email
|
||||
# If notification_type isn’t specified then we can’t normalise the
|
||||
# phone number to 4477… so this query will only find the email sent
|
||||
# to 077@example.com
|
||||
results = dao_get_notifications_by_recipient_or_reference(service.id, '077')
|
||||
assert len(results) == 2
|
||||
assert len(results) == 1
|
||||
assert results[0].id == email.id
|
||||
assert results[1].id == sms.id
|
||||
|
||||
results = dao_get_notifications_by_recipient_or_reference(service.id, '077@')
|
||||
assert len(results) == 1
|
||||
|
||||
Reference in New Issue
Block a user