1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-22 05:20:56 +01:00

Fix ContainsConstraints for array-valued custom field constraints in "*.search" methods

Summary: Fixes T11593. We ask for a list of values when searching for custom "link" fields, but don't handle it correctly when actually construcitng a query.

Test Plan:
Added this custom field:

```
{
  "mycompany.target-version": {
    "name": "Target Version",
    "type": "link",
    "search": true
  }
}
```

Set a task to "beta". Let daemons index it. Queried for:

```
constraints: {
  "custom.mycompany.target-version": [
    "beta"
  ]
}
```

Got just one result back.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11593

Differential Revision: https://secure.phabricator.com/D16508
This commit is contained in:
epriestley 2016-09-07 07:36:12 -07:00
parent 38ae81fb39
commit 76af4d649b

View file

@ -47,7 +47,12 @@ final class PhabricatorStandardCustomFieldLink
PhabricatorCursorPagedPolicyAwareQuery $query, PhabricatorCursorPagedPolicyAwareQuery $query,
$value) { $value) {
if (strlen($value)) { if (is_string($value) && !strlen($value)) {
return;
}
$value = (array)$value;
if ($value) {
$query->withApplicationSearchContainsConstraint( $query->withApplicationSearchContainsConstraint(
$this->newStringIndex(null), $this->newStringIndex(null),
$value); $value);