Index: src/applications/differential/conduit/ConduitAPI_differential_Method.php =================================================================== --- src/applications/differential/conduit/ConduitAPI_differential_Method.php +++ src/applications/differential/conduit/ConduitAPI_differential_Method.php @@ -1,8 +1,5 @@ getUser(); $id = $request->getValue('revisionID'); $revision = id(new DifferentialRevisionQuery()) ->withIDs(array($id)) - ->setViewer($request->getUser()) - ->needRelationships(true) + ->setViewer($viewer) ->needReviewerStatus(true) ->executeOne(); if (!$revision) { throw new ConduitException('ERR_NOT_FOUND'); } - if ($revision->getStatus() == ArcanistDifferentialRevisionStatus::CLOSED) { - // This can occur if someone runs 'close-revision' and hits a race, or - // they have a remote hook installed but don't have the - // 'remote_hook_installed' flag set, or similar. In any case, just treat - // it as a no-op rather than adding another "X closed this revision" - // message to the revision comments. - return; - } + $xactions = array(); + $xactions[] = id(new DifferentialTransaction()) + ->setTransactionType(DifferentialTransaction::TYPE_ACTION) + ->setNewValue(DifferentialAction::ACTION_CLOSE); $content_source = PhabricatorContentSource::newForSource( PhabricatorContentSource::SOURCE_CONDUIT, array()); - $editor = new DifferentialCommentEditor( - $revision, - DifferentialAction::ACTION_CLOSE); - $editor->setContentSource($content_source); - $editor->setActor($request->getUser()); - $editor->save(); + $editor = id(new DifferentialTransactionEditor()) + ->setActor($viewer) + ->setContentSourceFromConduitRequest($request) + ->setContinueOnMissingFields(true) + ->setContinueOnNoEffect(true); - $revision->setStatus(ArcanistDifferentialRevisionStatus::CLOSED); - $revision->save(); + $editor->applyTransactions($revision, $xactions); return; } Index: src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php =================================================================== --- src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php +++ src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php @@ -450,6 +450,16 @@ PhabricatorContentSource::newFromRequest($request)); } + public function setContentSourceFromConduitRequest( + ConduitAPIRequest $request) { + + $content_source = PhabricatorContentSource::newForSource( + PhabricatorContentSource::SOURCE_CONDUIT, + array()); + + return $this->setContentSource($content_source); + } + public function getContentSource() { return $this->contentSource; }