1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-30 01:10:58 +01:00

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
This commit is contained in:
epriestley 2014-02-13 12:26:44 -08:00
parent 29918e1bd4
commit 348b07a4be

View file

@ -319,28 +319,41 @@ final class PhabricatorFeedStoryDifferential extends PhabricatorFeedStory {
} }
// Roughly render inlines into the comment. // Roughly render inlines into the comment.
$comment_id = $data->getValue('temporaryCommentID'); $xaction_phids = $data->getValue('temporaryTransactionPHIDs');
if ($comment_id) { if ($xaction_phids) {
$inlines = id(new DifferentialInlineCommentQuery()) $inlines = id(new DifferentialTransactionQuery())
->withCommentIDs(array($comment_id)) ->setViewer(PhabricatorUser::getOmnipotentUser())
->withPHIDs($xaction_phids)
->needComments(true)
->withTransactionTypes(
array(
DifferentialTransaction::TYPE_INLINE,
))
->execute(); ->execute();
if ($inlines) { if ($inlines) {
$title .= "\n\n"; $title .= "\n\n";
$title .= pht('Inline Comments'); $title .= pht('Inline Comments');
$title .= "\n"; $title .= "\n";
$changeset_ids = mpull($inlines, 'getChangesetID');
$changeset_ids = array();
foreach ($inlines as $inline) {
$changeset_ids[] = $inline->getComment()->getChangesetID();
}
$changesets = id(new DifferentialChangeset())->loadAllWhere( $changesets = id(new DifferentialChangeset())->loadAllWhere(
'id IN (%Ld)', 'id IN (%Ld)',
$changeset_ids); $changeset_ids);
foreach ($inlines as $inline) { foreach ($inlines as $inline) {
$changeset = idx($changesets, $inline->getChangesetID()); $comment = $inline->getComment();
$changeset = idx($changesets, $comment->getChangesetID());
if (!$changeset) { if (!$changeset) {
continue; continue;
} }
$filename = $changeset->getDisplayFilename(); $filename = $changeset->getDisplayFilename();
$linenumber = $inline->getLineNumber(); $linenumber = $comment->getLineNumber();
$inline_text = $engine->markupText($inline->getContent()); $inline_text = $engine->markupText($comment->getContent());
$inline_text = rtrim($inline_text); $inline_text = rtrim($inline_text);
$title .= "{$filename}:{$linenumber} {$inline_text}\n"; $title .= "{$filename}:{$linenumber} {$inline_text}\n";