Use TransactionEditor in differential.createcomment

Summary: Ref T2222. Update this callsite; pretty straightforward.

Test Plan: Used Conduit to take actions and saw their effects in Differential.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2222

Differential Revision: https://secure.phabricator.com/D8442
This commit is contained in:
epriestley
2014-03-07 17:44:10 -08:00
parent b04f706c0a
commit 1c51ed5940
4 changed files with 97 additions and 55 deletions

View File

@@ -87,17 +87,9 @@ final class DifferentialCommentSaveController
->setNewValue(array('+' => $reviewer_edges));
}
$inline_phids = $this->loadUnsubmittedInlinePHIDs($revision);
if ($inline_phids) {
$inlines = id(new PhabricatorApplicationTransactionCommentQuery())
->setTemplate(new DifferentialTransactionComment())
->setViewer($viewer)
->withPHIDs($inline_phids)
->execute();
} else {
$inlines = array();
}
$inlines = DifferentialTransactionQuery::loadUnsubmittedInlineComments(
$viewer,
$revision);
foreach ($inlines as $inline) {
$xactions[] = id(new DifferentialTransaction())
->setTransactionType($type_inline)
@@ -153,30 +145,4 @@ final class DifferentialCommentSaveController
->setURI('/D'.$revision->getID());
}
private function loadUnsubmittedInlinePHIDs(DifferentialRevision $revision) {
$viewer = $this->getRequest()->getUser();
// TODO: This probably needs to move somewhere more central as we move
// away from DifferentialInlineCommentQuery, but
// PhabricatorApplicationTransactionCommentQuery is currently `final` and
// I'm not yet decided on how to approach that. For now, just get the PHIDs
// and then execute a PHID-based query through the standard stack.
$table = new DifferentialTransactionComment();
$conn_r = $table->establishConnection('r');
$phids = queryfx_all(
$conn_r,
'SELECT phid FROM %T
WHERE revisionPHID = %s
AND authorPHID = %s
AND transactionPHID IS NULL',
$table->getTableName(),
$revision->getPHID(),
$viewer->getPHID());
return ipull($phids, 'phid');
}
}