Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14003585
D12207.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
14 KB
Referenced Files
None
Subscribers
None
D12207.diff
View Options
diff --git a/src/applications/dashboard/controller/PhabricatorDashboardManageController.php b/src/applications/dashboard/controller/PhabricatorDashboardManageController.php
--- a/src/applications/dashboard/controller/PhabricatorDashboardManageController.php
+++ b/src/applications/dashboard/controller/PhabricatorDashboardManageController.php
@@ -165,12 +165,9 @@
pht('Editable By'),
$descriptions[PhabricatorPolicyCapability::CAN_EDIT]);
- $panel_phids = $dashboard->getPanelPHIDs();
- $this->loadHandles($panel_phids);
-
$properties->addProperty(
pht('Panels'),
- $this->renderHandlesForPHIDs($panel_phids));
+ $viewer->renderHandleList($dashboard->getPanelPHIDs()));
return $properties;
}
diff --git a/src/applications/dashboard/controller/PhabricatorDashboardPanelViewController.php b/src/applications/dashboard/controller/PhabricatorDashboardPanelViewController.php
--- a/src/applications/dashboard/controller/PhabricatorDashboardPanelViewController.php
+++ b/src/applications/dashboard/controller/PhabricatorDashboardPanelViewController.php
@@ -163,7 +163,6 @@
$dashboard_phids = PhabricatorEdgeQuery::loadDestinationPHIDs(
$panel->getPHID(),
PhabricatorDashboardPanelHasDashboardEdgeType::EDGECONST);
- $this->loadHandles($dashboard_phids);
$does_not_appear = pht(
'This panel does not appear on any dashboards.');
@@ -171,7 +170,7 @@
$properties->addProperty(
pht('Appears On'),
$dashboard_phids
- ? $this->renderHandlesForPHIDs($dashboard_phids)
+ ? $viewer->renderHandleList($dashboard_phids)
: phutil_tag('em', array(), $does_not_appear));
return $properties;
diff --git a/src/applications/files/controller/PhabricatorFileInfoController.php b/src/applications/files/controller/PhabricatorFileInfoController.php
--- a/src/applications/files/controller/PhabricatorFileInfoController.php
+++ b/src/applications/files/controller/PhabricatorFileInfoController.php
@@ -39,11 +39,6 @@
$phid = $file->getPHID();
- $handle_phids = array_merge(
- array($file->getAuthorPHID()),
- $file->getObjectPHIDs());
-
- $this->loadHandles($handle_phids);
$header = id(new PHUIHeaderView())
->setUser($user)
->setPolicyObject($file)
@@ -185,7 +180,6 @@
$request = $this->getRequest();
$user = $request->getUser();
-
$properties = id(new PHUIPropertyListView());
$properties->setActionList($actions);
$box->addPropertyList($properties, pht('Details'));
@@ -193,7 +187,7 @@
if ($file->getAuthorPHID()) {
$properties->addProperty(
pht('Author'),
- $this->getHandle($file->getAuthorPHID())->renderLink());
+ $user->renderHandle($file->getAuthorPHID()));
}
$properties->addProperty(
@@ -270,7 +264,7 @@
$attached->addProperty(
pht('Attached To'),
- $this->renderHandlesForPHIDs($phids));
+ $user->renderHandleList($phids));
}
diff --git a/src/applications/passphrase/controller/PassphraseCredentialViewController.php b/src/applications/passphrase/controller/PassphraseCredentialViewController.php
--- a/src/applications/passphrase/controller/PassphraseCredentialViewController.php
+++ b/src/applications/passphrase/controller/PassphraseCredentialViewController.php
@@ -189,10 +189,9 @@
PhabricatorCredentialsUsedByObjectEdgeType::EDGECONST);
if ($used_by_phids) {
- $this->loadHandles($used_by_phids);
$properties->addProperty(
pht('Used By'),
- $this->renderHandlesForPHIDs($used_by_phids));
+ $viewer->renderHandleList($used_by_phids));
}
$description = $credential->getDescription();
diff --git a/src/applications/paste/controller/PhabricatorPasteViewController.php b/src/applications/paste/controller/PhabricatorPasteViewController.php
--- a/src/applications/paste/controller/PhabricatorPasteViewController.php
+++ b/src/applications/paste/controller/PhabricatorPasteViewController.php
@@ -176,35 +176,35 @@
PhabricatorPaste $paste,
array $child_phids,
PhabricatorActionListView $actions) {
+ $viewer = $this->getViewer();
- $user = $this->getRequest()->getUser();
$properties = id(new PHUIPropertyListView())
- ->setUser($user)
+ ->setUser($viewer)
->setObject($paste)
->setActionList($actions);
$properties->addProperty(
pht('Author'),
- $this->getHandle($paste->getAuthorPHID())->renderLink());
+ $viewer->renderHandle($paste->getAuthorPHID()));
$properties->addProperty(
pht('Created'),
- phabricator_datetime($paste->getDateCreated(), $user));
+ phabricator_datetime($paste->getDateCreated(), $viewer));
if ($paste->getParentPHID()) {
$properties->addProperty(
pht('Forked From'),
- $this->getHandle($paste->getParentPHID())->renderLink());
+ $viewer->renderHandle($paste->getParentPHID()));
}
if ($child_phids) {
$properties->addProperty(
pht('Forks'),
- $this->renderHandlesForPHIDs($child_phids));
+ $viewer->renderHandleList($child_phids));
}
$descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions(
- $user,
+ $viewer,
$paste);
return $properties;
diff --git a/src/applications/people/storage/PhabricatorUser.php b/src/applications/people/storage/PhabricatorUser.php
--- a/src/applications/people/storage/PhabricatorUser.php
+++ b/src/applications/people/storage/PhabricatorUser.php
@@ -1,7 +1,8 @@
<?php
/**
- * @task factors Multi-Factor Authentication
+ * @task factors Multi-Factor Authentication
+ * @task handles Managing Handles
*/
final class PhabricatorUser
extends PhabricatorUserDAO
@@ -801,7 +802,7 @@
}
-/* -( Handles )------------------------------------------------------------ */
+/* -( Managing Handles )--------------------------------------------------- */
/**
@@ -810,6 +811,7 @@
*
* @param list<phid> List of PHIDs to load.
* @return PhabricatorHandleList Handle list object.
+ * @task handle
*/
public function loadHandles(array $phids) {
if ($this->handlePool === null) {
@@ -821,6 +823,34 @@
}
+ /**
+ * Get a @{class:PHUIHandleView} for a single handle.
+ *
+ * This benefits from the viewer's internal handle pool.
+ *
+ * @param phid PHID to render a handle for.
+ * @return PHUIHandleView View of the handle.
+ * @task handle
+ */
+ public function renderHandle($phid) {
+ return $this->loadHandles(array($phid))->renderHandle($phid);
+ }
+
+
+ /**
+ * Get a @{class:PHUIHandleListView} for a list of handles.
+ *
+ * This benefits from the viewer's internal handle pool.
+ *
+ * @param list<phid> List of PHIDs to render.
+ * @return PHUIHandleListView View of the handles.
+ * @task handle
+ */
+ public function renderHandleList(array $phids) {
+ return $this->loadHandles($phids)->renderList();
+ }
+
+
/* -( PhabricatorPolicyInterface )----------------------------------------- */
diff --git a/src/applications/pholio/controller/PholioMockViewController.php b/src/applications/pholio/controller/PholioMockViewController.php
--- a/src/applications/pholio/controller/PholioMockViewController.php
+++ b/src/applications/pholio/controller/PholioMockViewController.php
@@ -42,8 +42,6 @@
$mock->getPHID(),
PholioMockHasTaskEdgeType::EDGECONST);
$this->setManiphestTaskPHIDs($phids);
- $phids[] = $mock->getAuthorPHID();
- $this->loadHandles($phids);
$engine = id(new PhabricatorMarkupEngine())
->setViewer($user);
@@ -167,7 +165,7 @@
$properties->addProperty(
pht('Author'),
- $this->getHandle($mock->getAuthorPHID())->renderLink());
+ $user->renderHandle($mock->getAuthorPHID()));
$properties->addProperty(
pht('Created'),
@@ -176,7 +174,7 @@
if ($this->getManiphestTaskPHIDs()) {
$properties->addProperty(
pht('Maniphest Tasks'),
- $this->renderHandlesForPHIDs($this->getManiphestTaskPHIDs()));
+ $user->renderHandleList($this->getManiphestTaskPHIDs()));
}
$properties->invokeWillRenderEvent();
diff --git a/src/applications/phortune/controller/PhortuneAccountListController.php b/src/applications/phortune/controller/PhortuneAccountListController.php
--- a/src/applications/phortune/controller/PhortuneAccountListController.php
+++ b/src/applications/phortune/controller/PhortuneAccountListController.php
@@ -36,12 +36,10 @@
foreach ($accounts as $account) {
$this->loadHandles($account->getMemberPHIDs());
- $members = $this->renderHandlesForPHIDs($account->getMemberPHIDs(), ',');
$item = id(new PHUIObjectItemView())
->setObjectName(pht('Account %d', $account->getID()))
->setHeader($account->getName())
->setHref($this->getApplicationURI($account->getID().'/'))
- ->addAttribute(pht('Members: %s', $members))
->setObject($account);
$payment_list->addItem($item);
diff --git a/src/applications/phortune/controller/PhortuneAccountViewController.php b/src/applications/phortune/controller/PhortuneAccountViewController.php
--- a/src/applications/phortune/controller/PhortuneAccountViewController.php
+++ b/src/applications/phortune/controller/PhortuneAccountViewController.php
@@ -57,11 +57,9 @@
->setObject($account)
->setUser($viewer);
- $this->loadHandles($account->getMemberPHIDs());
-
$properties->addProperty(
pht('Members'),
- $this->renderHandlesForPHIDs($account->getMemberPHIDs()));
+ $viewer->renderHandleList($account->getMemberPHIDs()));
$status_items = $this->getStatusItemsForAccount($account, $invoices);
$status_view = new PHUIStatusListView();
@@ -137,10 +135,6 @@
->withAccountPHIDs(array($account->getPHID()))
->execute();
- if ($methods) {
- $this->loadHandles(mpull($methods, 'getAuthorPHID'));
- }
-
foreach ($methods as $method) {
$id = $method->getID();
diff --git a/src/applications/phortune/controller/PhortuneMerchantViewController.php b/src/applications/phortune/controller/PhortuneMerchantViewController.php
--- a/src/applications/phortune/controller/PhortuneMerchantViewController.php
+++ b/src/applications/phortune/controller/PhortuneMerchantViewController.php
@@ -135,11 +135,9 @@
$view->addProperty(pht('Status'), $status_view);
- $this->loadHandles($merchant->getMemberPHIDs());
-
$view->addProperty(
pht('Members'),
- $this->renderHandlesForPHIDs($merchant->getMemberPHIDs()));
+ $viewer->renderHandleList($merchant->getMemberPHIDs()));
$view->invokeWillRenderEvent();
diff --git a/src/applications/phragment/controller/PhragmentController.php b/src/applications/phragment/controller/PhragmentController.php
--- a/src/applications/phragment/controller/PhragmentController.php
+++ b/src/applications/phragment/controller/PhragmentController.php
@@ -57,21 +57,15 @@
$viewer = $this->getRequest()->getUser();
- $phids = array();
- $phids[] = $fragment->getLatestVersionPHID();
-
$snapshot_phids = array();
$snapshots = id(new PhragmentSnapshotQuery())
->setViewer($viewer)
->withPrimaryFragmentPHIDs(array($fragment->getPHID()))
->execute();
foreach ($snapshots as $snapshot) {
- $phids[] = $snapshot->getPHID();
$snapshot_phids[] = $snapshot->getPHID();
}
- $this->loadHandles($phids);
-
$file = null;
$file_uri = null;
if (!$fragment->isDirectory()) {
@@ -183,7 +177,7 @@
}
$properties->addProperty(
pht('Latest Version'),
- $this->renderHandlesForPHIDs(array($fragment->getLatestVersionPHID())));
+ $viewer->renderHandle($fragment->getLatestVersionPHID()));
} else {
$properties->addProperty(
pht('Type'),
@@ -193,7 +187,7 @@
if (count($snapshot_phids) > 0) {
$properties->addProperty(
pht('Snapshots'),
- $this->renderHandlesForPHIDs($snapshot_phids));
+ $viewer->renderHandleList($snapshot_phids));
}
return id(new PHUIObjectBoxView())
diff --git a/src/applications/phragment/controller/PhragmentCreateController.php b/src/applications/phragment/controller/PhragmentCreateController.php
--- a/src/applications/phragment/controller/PhragmentCreateController.php
+++ b/src/applications/phragment/controller/PhragmentCreateController.php
@@ -43,8 +43,11 @@
$errors[] = pht('The fragment name can not contain \'/\'.');
}
- $file = id(new PhabricatorFile())->load($v_fileid);
- if ($file === null) {
+ $file = id(new PhabricatorFileQuery())
+ ->setViewer($viewer)
+ ->withIDs(array($v_fileid))
+ ->executeOne();
+ if (!$file) {
$errors[] = pht('The specified file doesn\'t exist.');
}
@@ -115,9 +118,12 @@
$box = id(new PHUIObjectBoxView())
->setHeaderText('Create Fragment')
- ->setValidationException(null)
->setForm($form);
+ if ($error_view) {
+ $box->setInfoView($error_view);
+ }
+
return $this->buildApplicationPage(
array(
$crumbs,
diff --git a/src/applications/phragment/controller/PhragmentSnapshotViewController.php b/src/applications/phragment/controller/PhragmentSnapshotViewController.php
--- a/src/applications/phragment/controller/PhragmentSnapshotViewController.php
+++ b/src/applications/phragment/controller/PhragmentSnapshotViewController.php
@@ -90,11 +90,6 @@
$viewer = $this->getRequest()->getUser();
- $phids = array();
- $phids[] = $snapshot->getPrimaryFragmentPHID();
-
- $this->loadHandles($phids);
-
$header = id(new PHUIHeaderView())
->setHeader(pht('"%s" Snapshot', $snapshot->getName()))
->setPolicyObject($snapshot)
@@ -146,7 +141,7 @@
$snapshot->getName());
$properties->addProperty(
pht('Fragment'),
- $this->renderHandlesForPHIDs(array($snapshot->getPrimaryFragmentPHID())));
+ $viewer->renderHandle($snapshot->getPrimaryFragmentPHID()));
return id(new PHUIObjectBoxView())
->setHeader($header)
diff --git a/src/applications/phragment/controller/PhragmentVersionController.php b/src/applications/phragment/controller/PhragmentVersionController.php
--- a/src/applications/phragment/controller/PhragmentVersionController.php
+++ b/src/applications/phragment/controller/PhragmentVersionController.php
@@ -33,11 +33,6 @@
$crumbs = $this->buildApplicationCrumbsWithPath($parents);
$crumbs->addTextCrumb(pht('View Version %d', $version->getSequence()));
- $phids = array();
- $phids[] = $version->getFilePHID();
-
- $this->loadHandles($phids);
-
$file = id(new PhabricatorFileQuery())
->setViewer($viewer)
->withPHIDs(array($version->getFilePHID()))
@@ -71,7 +66,7 @@
->setActionList($actions);
$properties->addProperty(
pht('File'),
- $this->renderHandlesForPHIDs(array($version->getFilePHID())));
+ $viewer->renderHandle($version->getFilePHID()));
$box = id(new PHUIObjectBoxView())
->setHeader($header)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Oct 27, 8:00 AM (3 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6716176
Default Alt Text
D12207.diff (14 KB)
Attached To
Mode
D12207: Remove most callsites to Controller->renderHandlesForPHIDs()
Attached
Detach File
Event Timeline
Log In to Comment