fix bug where soft-deleted orgs would be returned by list
Created by: sqs
If an org was (soft-)deleted, it would still be returned by an org list call if its display name matched the list options query. This is because the name ILIKE %s OR display_name ILIKE %s
condition was not being wrapped in (...)
when interpolated into the SQL query, and the OR
made the first condition deleted_at IS NULL
ineffective.
This caused a bug where if you deleted an org (in site admin) and then searched for it by display name, you would not see any results and would only see an error Org not found: id 1234
.