From 348b07a4becf487b0bd654fa7a6993912ca9fce0 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 13 Feb 2014 12:26:44 -0800 Subject: [PATCH] Make Asana bridge work with new Differential transactions Summary: Ref T2222. Unbreak the Asana/JIRA bridge. Test Plan: {F112712} Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T2222 Differential Revision: https://secure.phabricator.com/D8217 --- .../PhabricatorFeedStoryDifferential.php | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/src/applications/feed/story/PhabricatorFeedStoryDifferential.php b/src/applications/feed/story/PhabricatorFeedStoryDifferential.php index 6a5c70b525..f6dc133804 100644 --- a/src/applications/feed/story/PhabricatorFeedStoryDifferential.php +++ b/src/applications/feed/story/PhabricatorFeedStoryDifferential.php @@ -319,28 +319,41 @@ final class PhabricatorFeedStoryDifferential extends PhabricatorFeedStory { } // Roughly render inlines into the comment. - $comment_id = $data->getValue('temporaryCommentID'); - if ($comment_id) { - $inlines = id(new DifferentialInlineCommentQuery()) - ->withCommentIDs(array($comment_id)) + $xaction_phids = $data->getValue('temporaryTransactionPHIDs'); + if ($xaction_phids) { + $inlines = id(new DifferentialTransactionQuery()) + ->setViewer(PhabricatorUser::getOmnipotentUser()) + ->withPHIDs($xaction_phids) + ->needComments(true) + ->withTransactionTypes( + array( + DifferentialTransaction::TYPE_INLINE, + )) ->execute(); if ($inlines) { $title .= "\n\n"; $title .= pht('Inline Comments'); $title .= "\n"; - $changeset_ids = mpull($inlines, 'getChangesetID'); + + $changeset_ids = array(); + foreach ($inlines as $inline) { + $changeset_ids[] = $inline->getComment()->getChangesetID(); + } + $changesets = id(new DifferentialChangeset())->loadAllWhere( 'id IN (%Ld)', $changeset_ids); + foreach ($inlines as $inline) { - $changeset = idx($changesets, $inline->getChangesetID()); + $comment = $inline->getComment(); + $changeset = idx($changesets, $comment->getChangesetID()); if (!$changeset) { continue; } $filename = $changeset->getDisplayFilename(); - $linenumber = $inline->getLineNumber(); - $inline_text = $engine->markupText($inline->getContent()); + $linenumber = $comment->getLineNumber(); + $inline_text = $engine->markupText($comment->getContent()); $inline_text = rtrim($inline_text); $title .= "{$filename}:{$linenumber} {$inline_text}\n";