mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-30 09:20:58 +01:00
Ported loadAuxiliaryFields method to differential.query conduit method
Summary: Ported the the loadAuxiliaryfields method from differential.getrevision method to modern conduit differential.query method Test Plan: Created a test diff in differential to see if nothing has been broken Reviewers: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D5230
This commit is contained in:
parent
1bb160a244
commit
a521790f13
1 changed files with 23 additions and 0 deletions
|
@ -196,6 +196,8 @@ final class ConduitAPI_differential_query_Method
|
|||
}
|
||||
|
||||
$id = $revision->getID();
|
||||
$auxiliary_fields = $this->loadAuxiliaryFields(
|
||||
$revision, $request->getUser());
|
||||
$result = array(
|
||||
'id' => $id,
|
||||
'phid' => $revision->getPHID(),
|
||||
|
@ -217,6 +219,7 @@ final class ConduitAPI_differential_query_Method
|
|||
'reviewers' => array_values($revision->getReviewers()),
|
||||
'ccs' => array_values($revision->getCCPHIDs()),
|
||||
'hashes' => $revision->getHashes(),
|
||||
'auxiliary' => $auxiliary_fields,
|
||||
);
|
||||
|
||||
// TODO: This is a hacky way to put permissions on this field until we
|
||||
|
@ -230,4 +233,24 @@ final class ConduitAPI_differential_query_Method
|
|||
|
||||
return $results;
|
||||
}
|
||||
|
||||
private function loadAuxiliaryFields(
|
||||
DifferentialRevision $revision,
|
||||
PhabricatorUser $user) {
|
||||
$aux_fields = DifferentialFieldSelector::newSelector()
|
||||
->getFieldSpecifications();
|
||||
foreach ($aux_fields as $key => $aux_field) {
|
||||
$aux_field->setUser($user);
|
||||
if (!$aux_field->shouldAppearOnConduitView()) {
|
||||
unset($aux_fields[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
$aux_fields = DifferentialAuxiliaryField::loadFromStorage(
|
||||
$revision,
|
||||
$aux_fields);
|
||||
|
||||
return mpull($aux_fields, 'getValueForConduit', 'getKeyForConduit');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue