mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
Enrich the "change project tags" transaction in "transaction.search"
Summary: Depends on D20208. Ref T13255. See that task for some long-winded discussion and rationale. Short version: - This is a list of operations instead of a list of old/new PHIDs because of scalability issues for large lists (T13056). - This is a fairly verbose list (instead of, for example, the more concise internal map we sometimes use with "+" and "-" as keys) to try to make the structure obvious and extensible in the future. - The "add" and "remove" echo the `*.edit` operations. Test Plan: Called `transaction.search` on an object with project tag changes, saw them in the results. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13255 Differential Revision: https://secure.phabricator.com/D20209
This commit is contained in:
parent
f61e825905
commit
83aba7b01c
1 changed files with 32 additions and 0 deletions
|
@ -202,6 +202,14 @@ final class TransactionSearchConduitAPIMethod
|
|||
case PhabricatorTransactions::TYPE_CREATE:
|
||||
$type = 'create';
|
||||
break;
|
||||
case PhabricatorTransactions::TYPE_EDGE:
|
||||
switch ($xaction->getMetadataValue('edge:type')) {
|
||||
case PhabricatorProjectObjectHasProjectEdgeType::EDGECONST:
|
||||
$type = 'projects';
|
||||
$fields = $this->newEdgeTransactionFields($xaction);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -264,5 +272,29 @@ final class TransactionSearchConduitAPIMethod
|
|||
return $query;
|
||||
}
|
||||
|
||||
private function newEdgeTransactionFields(
|
||||
PhabricatorApplicationTransaction $xaction) {
|
||||
|
||||
$record = PhabricatorEdgeChangeRecord::newFromTransaction($xaction);
|
||||
|
||||
$operations = array();
|
||||
foreach ($record->getAddedPHIDs() as $phid) {
|
||||
$operations[] = array(
|
||||
'operation' => 'add',
|
||||
'phid' => $phid,
|
||||
);
|
||||
}
|
||||
|
||||
foreach ($record->getRemovedPHIDs() as $phid) {
|
||||
$operations[] = array(
|
||||
'operation' => 'remove',
|
||||
'phid' => $phid,
|
||||
);
|
||||
}
|
||||
|
||||
return array(
|
||||
'operations' => $operations,
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue