From 425590a03a94f19d5f497187df28d24acd540702 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 23 Sep 2013 14:30:54 -0700 Subject: [PATCH] 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 --- ...I_maniphest_gettasktransactions_Method.php | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/applications/maniphest/conduit/ConduitAPI_maniphest_gettasktransactions_Method.php b/src/applications/maniphest/conduit/ConduitAPI_maniphest_gettasktransactions_Method.php index a790d662c6..dc25cd05ce 100644 --- a/src/applications/maniphest/conduit/ConduitAPI_maniphest_gettasktransactions_Method.php +++ b/src/applications/maniphest/conduit/ConduitAPI_maniphest_gettasktransactions_Method.php @@ -39,24 +39,34 @@ final class ConduitAPI_maniphest_gettasktransactions_Method ->execute(); $tasks = mpull($tasks, null, 'getPHID'); - $transactions = ManiphestLegacyTransactionQuery::loadByTasks( - $request->getUser(), - $tasks); + $transactions = array(); + if ($tasks) { + $transactions = id(new ManiphestTransactionQuery()) + ->setViewer($request->getUser()) + ->withObjectPHIDs(mpull($tasks, 'getPHID')) + ->needComments(true) + ->execute(); + } foreach ($transactions as $transaction) { - $task_phid = $transaction->getTaskPHID(); + $task_phid = $transaction->getObjectPHID(); if (empty($tasks[$task_phid])) { continue; } $task_id = $tasks[$task_phid]->getID(); + $comments = null; + if ($transaction->hasComment()) { + $comments = $transaction->getComment()->getContent(); + } + $results[$task_id][] = array( 'taskID' => $task_id, 'transactionType' => $transaction->getTransactionType(), 'oldValue' => $transaction->getOldValue(), 'newValue' => $transaction->getNewValue(), - 'comments' => $transaction->getComments(), + 'comments' => $comments, 'authorPHID' => $transaction->getAuthorPHID(), 'dateCreated' => $transaction->getDateCreated(), );