mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-25 00:02:41 +01:00
b5dfd34e4a
Summary: Ref T8441. Does what it says, provided other conditions (like using the new SearchField stuff) are fulfilled. Test Plan: {F473836} {F473837} Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T8441 Differential Revision: https://secure.phabricator.com/D13171
43 lines
981 B
PHP
43 lines
981 B
PHP
<?php
|
|
|
|
final class PhabricatorSearchSpacesField
|
|
extends PhabricatorSearchTokenizerField {
|
|
|
|
protected function getDefaultValue() {
|
|
return array();
|
|
}
|
|
|
|
protected function newDatasource() {
|
|
return new PhabricatorSpacesNamespaceDatasource();
|
|
}
|
|
|
|
protected function getValueFromRequest(AphrontRequest $request, $key) {
|
|
$viewer = $this->getViewer();
|
|
$list = $this->getListFromRequest($request, $key);
|
|
|
|
$type = new PhabricatorSpacesNamespacePHIDType();
|
|
$phids = array();
|
|
$names = array();
|
|
foreach ($list as $item) {
|
|
if ($type->canLoadNamedObject($item)) {
|
|
$names[] = $item;
|
|
} else {
|
|
$phids[] = $item;
|
|
}
|
|
}
|
|
|
|
if ($names) {
|
|
$spaces = id(new PhabricatorObjectQuery())
|
|
->setViewer($viewer)
|
|
->withNames($names)
|
|
->execute();
|
|
foreach (mpull($spaces, 'getPHID') as $phid) {
|
|
$phids[] = $phid;
|
|
}
|
|
$phids = array_unique($phids);
|
|
}
|
|
|
|
return $phids;
|
|
}
|
|
|
|
}
|