1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-23 07:12:41 +01:00

Use ManiphestTransactionQuery directly in maniphest.gettasktransactions

Summary: Ref T2217. Nukes a LegacyQuery callsite.

Test Plan: Called method using console, verified data looks sane.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2217

Differential Revision: https://secure.phabricator.com/D7077
This commit is contained in:
epriestley 2013-09-23 14:30:54 -07:00
parent 02ed9f1368
commit 425590a03a

View file

@ -39,24 +39,34 @@ final class ConduitAPI_maniphest_gettasktransactions_Method
->execute(); ->execute();
$tasks = mpull($tasks, null, 'getPHID'); $tasks = mpull($tasks, null, 'getPHID');
$transactions = ManiphestLegacyTransactionQuery::loadByTasks( $transactions = array();
$request->getUser(), if ($tasks) {
$tasks); $transactions = id(new ManiphestTransactionQuery())
->setViewer($request->getUser())
->withObjectPHIDs(mpull($tasks, 'getPHID'))
->needComments(true)
->execute();
}
foreach ($transactions as $transaction) { foreach ($transactions as $transaction) {
$task_phid = $transaction->getTaskPHID(); $task_phid = $transaction->getObjectPHID();
if (empty($tasks[$task_phid])) { if (empty($tasks[$task_phid])) {
continue; continue;
} }
$task_id = $tasks[$task_phid]->getID(); $task_id = $tasks[$task_phid]->getID();
$comments = null;
if ($transaction->hasComment()) {
$comments = $transaction->getComment()->getContent();
}
$results[$task_id][] = array( $results[$task_id][] = array(
'taskID' => $task_id, 'taskID' => $task_id,
'transactionType' => $transaction->getTransactionType(), 'transactionType' => $transaction->getTransactionType(),
'oldValue' => $transaction->getOldValue(), 'oldValue' => $transaction->getOldValue(),
'newValue' => $transaction->getNewValue(), 'newValue' => $transaction->getNewValue(),
'comments' => $transaction->getComments(), 'comments' => $comments,
'authorPHID' => $transaction->getAuthorPHID(), 'authorPHID' => $transaction->getAuthorPHID(),
'dateCreated' => $transaction->getDateCreated(), 'dateCreated' => $transaction->getDateCreated(),
); );