Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14030784
D8819.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
7 KB
Referenced Files
None
Subscribers
None
D8819.diff
View Options
diff --git a/src/applications/releeph/conduit/ConduitAPI_releeph_request_Method.php b/src/applications/releeph/conduit/ConduitAPI_releeph_request_Method.php
--- a/src/applications/releeph/conduit/ConduitAPI_releeph_request_Method.php
+++ b/src/applications/releeph/conduit/ConduitAPI_releeph_request_Method.php
@@ -28,6 +28,12 @@
protected function execute(ConduitAPIRequest $request) {
$user = $request->getUser();
+
+ $viewer_handle = id(new PhabricatorHandleQuery())
+ ->setViewer($user)
+ ->withPHIDs(array($user->getPHID()))
+ ->executeOne();
+
$branch_phid = $request->getValue('branchPHID');
$releeph_branch = id(new ReleephBranch())
->loadOneWhere('phid = %s', $branch_phid);
@@ -131,15 +137,7 @@
$editor->applyTransactions($releeph_request, $xactions);
}
- $releeph_branch->populateReleephRequestHandles(
- $user,
- array($releeph_request));
- $rq_handles = $releeph_request->getHandles();
- $requestor_phid = $releeph_request->getRequestUserPHID();
- $requestor = $rq_handles[$requestor_phid]->getName();
-
- $url = PhabricatorEnv::getProductionURI('/RQ'.$releeph_request->getID());
-
+ $url = PhabricatorEnv::getProductionURI('/Y'.$releeph_request->getID());
$results[$thing] = array(
'thing' => $thing,
'branch' => $releeph_branch->getDisplayNameWithDetail(),
@@ -147,7 +145,7 @@
'commitID' => $commit->getCommitIdentifier(),
'url' => $url,
'requestID' => $releeph_request->getID(),
- 'requestor' => $requestor,
+ 'requestor' => $viewer_handle->getName(),
'requestTime' => $releeph_request->getDateCreated(),
'existing' => $existing_releeph_request !== null,
);
diff --git a/src/applications/releeph/conduit/work/ConduitAPI_releephwork_nextrequest_Method.php b/src/applications/releeph/conduit/work/ConduitAPI_releephwork_nextrequest_Method.php
--- a/src/applications/releeph/conduit/work/ConduitAPI_releephwork_nextrequest_Method.php
+++ b/src/applications/releeph/conduit/work/ConduitAPI_releephwork_nextrequest_Method.php
@@ -18,8 +18,8 @@
public function defineParamTypes() {
return array(
- 'branchPHID' => 'required int',
- 'seen' => 'required list<string, bool>',
+ 'branchPHID' => 'required phid',
+ 'seen' => 'required map<string, bool>',
);
}
@@ -35,6 +35,7 @@
}
protected function execute(ConduitAPIRequest $request) {
+ $viewer = $request->getUser();
$seen = $request->getValue('seen');
$branch = id(new ReleephBranch())
@@ -45,7 +46,11 @@
$needs_pick = array();
$needs_revert = array();
- $releeph_requests = $branch->loadReleephRequests($request->getUser());
+ // Load every request ever made for this branch...?!!!
+ $releeph_requests = id(new ReleephRequestQuery())
+ ->setViewer($viewer)
+ ->withBranchIDs(array($branch->getID()))
+ ->execute();
foreach ($releeph_requests as $candidate) {
$phid = $candidate->getPHID();
diff --git a/src/applications/releeph/controller/request/ReleephRequestEditController.php b/src/applications/releeph/controller/request/ReleephRequestEditController.php
--- a/src/applications/releeph/controller/request/ReleephRequestEditController.php
+++ b/src/applications/releeph/controller/request/ReleephRequestEditController.php
@@ -178,8 +178,19 @@
}
}
- $branch->populateReleephRequestHandles($viewer, array($pull));
- $handles = $pull->getHandles();
+ $handle_phids = array(
+ $pull->getRequestUserPHID(),
+ $pull->getRequestCommitPHID(),
+ );
+ $handle_phids = array_filter($handle_phids);
+ if ($handle_phids) {
+ $handles = id(new PhabricatorHandleQuery())
+ ->setViewer($viewer)
+ ->withPHIDs($handle_phids)
+ ->execute();
+ } else {
+ $handles = array();
+ }
$age_string = '';
if ($is_edit) {
diff --git a/src/applications/releeph/field/specification/ReleephBranchCommitFieldSpecification.php b/src/applications/releeph/field/specification/ReleephBranchCommitFieldSpecification.php
--- a/src/applications/releeph/field/specification/ReleephBranchCommitFieldSpecification.php
+++ b/src/applications/releeph/field/specification/ReleephBranchCommitFieldSpecification.php
@@ -11,24 +11,18 @@
return 'Commit';
}
- public function renderPropertyViewValue(array $handles) {
- $rr = $this->getReleephRequest();
- if (!$rr->getInBranch()) {
- return null;
+ public function getRequiredHandlePHIDsForPropertyView() {
+ $pull = $this->getReleephRequest();
+
+ if ($pull->getCommitPHID()) {
+ return array($pull->getCommitPHID());
}
- $c_phid = $rr->getCommitPHID();
- $c_id = $rr->getCommitIdentifier();
+ return array();
+ }
- if ($c_phid) {
- $handles = $rr->getHandles();
- $val = $handles[$c_phid]->renderLink();
- } else if ($c_id) {
- $val = $c_id;
- } else {
- $val = '???';
- }
- return $val;
+ public function renderPropertyViewValue(array $handles) {
+ return $this->renderHandleList($handles);
}
}
diff --git a/src/applications/releeph/storage/ReleephBranch.php b/src/applications/releeph/storage/ReleephBranch.php
--- a/src/applications/releeph/storage/ReleephBranch.php
+++ b/src/applications/releeph/storage/ReleephBranch.php
@@ -109,46 +109,6 @@
'getReleephProjectID');
}
- private function loadReleephRequestHandles(PhabricatorUser $user, $reqs) {
- $phids_to_phetch = array();
- foreach ($reqs as $rr) {
- $phids_to_phetch[] = $rr->getRequestCommitPHID();
- $phids_to_phetch[] = $rr->getRequestUserPHID();
- $phids_to_phetch[] = $rr->getCommitPHID();
-
- $intents = $rr->getUserIntents();
- if ($intents) {
- foreach ($intents as $user_phid => $intent) {
- $phids_to_phetch[] = $user_phid;
- }
- }
-
- $request_commit = $rr->loadPhabricatorRepositoryCommit();
- if ($request_commit) {
- $phids_to_phetch[] = $request_commit->getAuthorPHID();
- $phids_to_phetch[] = $rr->loadRequestCommitDiffPHID();
- }
- }
- $handles = id(new PhabricatorHandleQuery())
- ->setViewer($user)
- ->withPHIDs($phids_to_phetch)
- ->execute();
- return $handles;
- }
-
- public function populateReleephRequestHandles(PhabricatorUser $user, $reqs) {
- $handles = $this->loadReleephRequestHandles($user, $reqs);
- foreach ($reqs as $req) {
- $req->setHandles($handles);
- }
- }
-
- public function loadReleephRequests(PhabricatorUser $user) {
- $reqs = $this->loadRelatives(new ReleephRequest(), 'branchID');
- $this->populateReleephRequestHandles($user, $reqs);
- return $reqs;
- }
-
public function isActive() {
return $this->getIsActive();
}
diff --git a/src/applications/releeph/storage/ReleephRequest.php b/src/applications/releeph/storage/ReleephRequest.php
--- a/src/applications/releeph/storage/ReleephRequest.php
+++ b/src/applications/releeph/storage/ReleephRequest.php
@@ -20,14 +20,10 @@
protected $commitIdentifier;
protected $commitPHID;
- // Pre-populated handles that we'll bulk load in ReleephBranch
- private $handles = self::ATTACHABLE;
-
private $customFields = self::ATTACHABLE;
private $branch = self::ATTACHABLE;
-
/* -( Constants and helper methods )--------------------------------------- */
const INTENT_WANT = 'want';
@@ -160,14 +156,6 @@
/* -( Helpful accessors )--------------------------------------------------- */
- public function setHandles($handles) {
- $this->handles = $handles;
- return $this;
- }
-
- public function getHandles() {
- return $this->assertAttached($this->handles);
- }
public function getDetail($key, $default = null) {
return idx($this->getDetails(), $key, $default);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 10, 6:42 AM (1 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6729594
Default Alt Text
D8819.diff (7 KB)
Attached To
Mode
D8819: Remove some ad-hoc handle loads from Releeph
Attached
Detach File
Event Timeline
Log In to Comment