@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 differential controllers

Summary:
Change all instances of `id(new DifferentialRevision())->load($id)` for `DifferentialRevisionQuery` where reviewers are loaded.
Also make sure that the new reviewer status is being loaded so that all calls to `getReviewers` can be removed in the near future.

Test Plan: Use all three controllers with several revisions and check they still work in sane way

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T1279

Differential Revision: https://secure.phabricator.com/D6466

authored by

Juan Pablo Civile and committed by
epriestley
ee9fac5c 10c9e387

+16 -6
+3 -1
src/applications/differential/controller/DifferentialRevisionEditController.php
··· 20 20 $revision = id(new DifferentialRevisionQuery()) 21 21 ->setViewer($viewer) 22 22 ->withIDs(array($this->id)) 23 + ->needRelationships(true) 24 + ->needReviewerStatus(true) 23 25 ->executeOne(); 24 26 if (!$revision) { 25 27 return new Aphront404Response(); 26 28 } 27 29 } else { 28 30 $revision = new DifferentialRevision(); 31 + $revision->attachRelationships(array()); 29 32 } 30 33 31 - $revision->loadRelationships(); 32 34 $aux_fields = $this->loadAuxiliaryFields($revision); 33 35 34 36 $diff_id = $request->getInt('diffID');
+7 -3
src/applications/differential/controller/DifferentialRevisionViewController.php
··· 18 18 $user = $request->getUser(); 19 19 $viewer_is_anonymous = !$user->isLoggedIn(); 20 20 21 - $revision = id(new DifferentialRevision())->load($this->revisionID); 21 + $revision = id(new DifferentialRevisionQuery()) 22 + ->withIDs(array($this->revisionID)) 23 + ->setViewer($request->getUser()) 24 + ->needRelationships(true) 25 + ->needReviewerStatus(true) 26 + ->executeOne(); 27 + 22 28 if (!$revision) { 23 29 return new Aphront404Response(); 24 30 } 25 - 26 - $revision->loadRelationships(); 27 31 28 32 $diffs = $revision->loadDiffs(); 29 33
+6 -2
src/applications/differential/controller/DifferentialSubscribeController.php
··· 15 15 $request = $this->getRequest(); 16 16 $user = $request->getUser(); 17 17 18 - $revision = id(new DifferentialRevision())->load($this->id); 18 + $revision = id(new DifferentialRevisionQuery()) 19 + ->withIDs(array($this->id)) 20 + ->setViewer($request->getUser()) 21 + ->needRelationships(true) 22 + ->needReviewerStatus(true) 23 + ->executeOne(); 19 24 if (!$revision) { 20 25 return new Aphront404Response(); 21 26 } ··· 51 56 return id(new AphrontDialogResponse())->setDialog($dialog); 52 57 } 53 58 54 - $revision->loadRelationships(); 55 59 $phid = $user->getPHID(); 56 60 57 61 switch ($this->action) {