mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-09 16:32:39 +01:00
Fix querying for transactions over "transaction.search" when the object does not support comments
Summary: See PHI725. Ref T13151. We currently try to load comments unconditionally, but not all objects (like projects) have comments. Only try to load comments if an object actually has comments. Test Plan: Queried for an object with no comments, like project `#masonry`, via `transaction.search`. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13151 Differential Revision: https://secure.phabricator.com/D19507
This commit is contained in:
parent
cac3dc4983
commit
f94cee8628
1 changed files with 12 additions and 11 deletions
|
@ -85,22 +85,23 @@ final class TransactionSearchConduitAPIMethod
|
|||
|
||||
$xactions = $xaction_query->executeWithCursorPager($pager);
|
||||
|
||||
$comment_map = array();
|
||||
if ($xactions) {
|
||||
$template = head($xactions)->getApplicationTransactionCommentObject();
|
||||
if ($template) {
|
||||
|
||||
$query = new PhabricatorApplicationTransactionTemplatedCommentQuery();
|
||||
$query = new PhabricatorApplicationTransactionTemplatedCommentQuery();
|
||||
|
||||
$comment_map = $query
|
||||
->setViewer($viewer)
|
||||
->setTemplate($template)
|
||||
->withTransactionPHIDs(mpull($xactions, 'getPHID'))
|
||||
->execute();
|
||||
$comment_map = $query
|
||||
->setViewer($viewer)
|
||||
->setTemplate($template)
|
||||
->withTransactionPHIDs(mpull($xactions, 'getPHID'))
|
||||
->execute();
|
||||
|
||||
$comment_map = msort($comment_map, 'getCommentVersion');
|
||||
$comment_map = array_reverse($comment_map);
|
||||
$comment_map = mgroup($comment_map, 'getTransactionPHID');
|
||||
} else {
|
||||
$comment_map = array();
|
||||
$comment_map = msort($comment_map, 'getCommentVersion');
|
||||
$comment_map = array_reverse($comment_map);
|
||||
$comment_map = mgroup($comment_map, 'getTransactionPHID');
|
||||
}
|
||||
}
|
||||
|
||||
$modular_classes = array();
|
||||
|
|
Loading…
Reference in a new issue