mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-03 19:31:02 +01:00
Use DifferentialRevisionQuery in conduit when reviewers are needed
Summary: Ref T1279. Switched all differential conduit methods to use `DifferentialRevisionQuery` where `loadRelations` was being used. Test Plan: Called all the methods changed and verified they still worked as advertised. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T603, T1279 Differential Revision: https://secure.phabricator.com/D6452
This commit is contained in:
parent
d4c28dcbc2
commit
d6ce5a31e3
4 changed files with 27 additions and 10 deletions
|
@ -29,7 +29,12 @@ final class ConduitAPI_differential_close_Method
|
|||
protected function execute(ConduitAPIRequest $request) {
|
||||
$id = $request->getValue('revisionID');
|
||||
|
||||
$revision = id(new DifferentialRevision())->load($id);
|
||||
$revision = id(new DifferentialRevisionQuery())
|
||||
->withIDs(array($id))
|
||||
->setViewer($request->getUser())
|
||||
->needRelationships(true)
|
||||
->needReviewerStatus(true)
|
||||
->executeOne();
|
||||
if (!$revision) {
|
||||
throw new ConduitException('ERR_NOT_FOUND');
|
||||
}
|
||||
|
@ -43,8 +48,6 @@ final class ConduitAPI_differential_close_Method
|
|||
return;
|
||||
}
|
||||
|
||||
$revision->loadRelationships();
|
||||
|
||||
$content_source = PhabricatorContentSource::newForSource(
|
||||
PhabricatorContentSource::SOURCE_CONDUIT,
|
||||
array());
|
||||
|
|
|
@ -32,15 +32,21 @@ final class ConduitAPI_differential_getcommitmessage_Method
|
|||
$id = $request->getValue('revision_id');
|
||||
|
||||
if ($id) {
|
||||
$revision = id(new DifferentialRevision())->load($id);
|
||||
$revision = id(new DifferentialRevisionQuery())
|
||||
->withIDs(array($id))
|
||||
->setViewer($request->getUser())
|
||||
->needRelationships(true)
|
||||
->needReviewerStatus(true)
|
||||
->executeOne();
|
||||
|
||||
if (!$revision) {
|
||||
throw new ConduitException('ERR_NOT_FOUND');
|
||||
}
|
||||
} else {
|
||||
$revision = new DifferentialRevision();
|
||||
$revision->attachRelationships(array());
|
||||
}
|
||||
|
||||
$revision->loadRelationships();
|
||||
|
||||
$is_edit = $request->getValue('edit');
|
||||
$is_create = ($is_edit == 'create');
|
||||
|
|
|
@ -38,12 +38,17 @@ final class ConduitAPI_differential_getrevision_Method
|
|||
$diff = null;
|
||||
|
||||
$revision_id = $request->getValue('revision_id');
|
||||
$revision = id(new DifferentialRevision())->load($revision_id);
|
||||
$revision = id(new DifferentialRevisionQuery())
|
||||
->withIDs(array($revision_id))
|
||||
->setViewer($request->getUser())
|
||||
->needRelationships(true)
|
||||
->needReviewerStatus(true)
|
||||
->executeOne();
|
||||
|
||||
if (!$revision) {
|
||||
throw new ConduitException('ERR_BAD_REVISION');
|
||||
}
|
||||
|
||||
$revision->loadRelationships();
|
||||
$reviewer_phids = array_values($revision->getReviewers());
|
||||
|
||||
$diffs = $revision->loadDiffs();
|
||||
|
|
|
@ -38,7 +38,12 @@ final class ConduitAPI_differential_markcommitted_Method
|
|||
protected function execute(ConduitAPIRequest $request) {
|
||||
$id = $request->getValue('revision_id');
|
||||
|
||||
$revision = id(new DifferentialRevision())->load($id);
|
||||
$revision = id(new DifferentialRevisionQuery())
|
||||
->withIDs(array($id))
|
||||
->setViewer($request->getUser())
|
||||
->needRelationships(true)
|
||||
->needReviewerStatus(true)
|
||||
->executeOne();
|
||||
if (!$revision) {
|
||||
throw new ConduitException('ERR_NOT_FOUND');
|
||||
}
|
||||
|
@ -47,8 +52,6 @@ final class ConduitAPI_differential_markcommitted_Method
|
|||
return;
|
||||
}
|
||||
|
||||
$revision->loadRelationships();
|
||||
|
||||
$editor = new DifferentialCommentEditor(
|
||||
$revision,
|
||||
DifferentialAction::ACTION_CLOSE);
|
||||
|
|
Loading…
Reference in a new issue