@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

authored by

Juan Pablo Civile and committed by
epriestley
d6ce5a31 d4c28dcb

+27 -10
+6 -3
src/applications/differential/conduit/ConduitAPI_differential_close_Method.php
··· 29 29 protected function execute(ConduitAPIRequest $request) { 30 30 $id = $request->getValue('revisionID'); 31 31 32 - $revision = id(new DifferentialRevision())->load($id); 32 + $revision = id(new DifferentialRevisionQuery()) 33 + ->withIDs(array($id)) 34 + ->setViewer($request->getUser()) 35 + ->needRelationships(true) 36 + ->needReviewerStatus(true) 37 + ->executeOne(); 33 38 if (!$revision) { 34 39 throw new ConduitException('ERR_NOT_FOUND'); 35 40 } ··· 42 47 // message to the revision comments. 43 48 return; 44 49 } 45 - 46 - $revision->loadRelationships(); 47 50 48 51 $content_source = PhabricatorContentSource::newForSource( 49 52 PhabricatorContentSource::SOURCE_CONDUIT,
+8 -2
src/applications/differential/conduit/ConduitAPI_differential_getcommitmessage_Method.php
··· 32 32 $id = $request->getValue('revision_id'); 33 33 34 34 if ($id) { 35 - $revision = id(new DifferentialRevision())->load($id); 35 + $revision = id(new DifferentialRevisionQuery()) 36 + ->withIDs(array($id)) 37 + ->setViewer($request->getUser()) 38 + ->needRelationships(true) 39 + ->needReviewerStatus(true) 40 + ->executeOne(); 41 + 36 42 if (!$revision) { 37 43 throw new ConduitException('ERR_NOT_FOUND'); 38 44 } 39 45 } else { 40 46 $revision = new DifferentialRevision(); 47 + $revision->attachRelationships(array()); 41 48 } 42 49 43 - $revision->loadRelationships(); 44 50 45 51 $is_edit = $request->getValue('edit'); 46 52 $is_create = ($is_edit == 'create');
+7 -2
src/applications/differential/conduit/ConduitAPI_differential_getrevision_Method.php
··· 38 38 $diff = null; 39 39 40 40 $revision_id = $request->getValue('revision_id'); 41 - $revision = id(new DifferentialRevision())->load($revision_id); 41 + $revision = id(new DifferentialRevisionQuery()) 42 + ->withIDs(array($revision_id)) 43 + ->setViewer($request->getUser()) 44 + ->needRelationships(true) 45 + ->needReviewerStatus(true) 46 + ->executeOne(); 47 + 42 48 if (!$revision) { 43 49 throw new ConduitException('ERR_BAD_REVISION'); 44 50 } 45 51 46 - $revision->loadRelationships(); 47 52 $reviewer_phids = array_values($revision->getReviewers()); 48 53 49 54 $diffs = $revision->loadDiffs();
+6 -3
src/applications/differential/conduit/ConduitAPI_differential_markcommitted_Method.php
··· 38 38 protected function execute(ConduitAPIRequest $request) { 39 39 $id = $request->getValue('revision_id'); 40 40 41 - $revision = id(new DifferentialRevision())->load($id); 41 + $revision = id(new DifferentialRevisionQuery()) 42 + ->withIDs(array($id)) 43 + ->setViewer($request->getUser()) 44 + ->needRelationships(true) 45 + ->needReviewerStatus(true) 46 + ->executeOne(); 42 47 if (!$revision) { 43 48 throw new ConduitException('ERR_NOT_FOUND'); 44 49 } ··· 46 51 if ($revision->getStatus() == ArcanistDifferentialRevisionStatus::CLOSED) { 47 52 return; 48 53 } 49 - 50 - $revision->loadRelationships(); 51 54 52 55 $editor = new DifferentialCommentEditor( 53 56 $revision,