Page MenuHomePhabricator

D8810.id20909.diff
No OneTemporary

D8810.id20909.diff

diff --git a/src/applications/differential/customfield/DifferentialCustomField.php b/src/applications/differential/customfield/DifferentialCustomField.php
--- a/src/applications/differential/customfield/DifferentialCustomField.php
+++ b/src/applications/differential/customfield/DifferentialCustomField.php
@@ -31,19 +31,6 @@
return parent::shouldEnableForRole($role);
}
- protected function renderHandleList(array $handles) {
- if (!$handles) {
- return null;
- }
-
- $out = array();
- foreach ($handles as $handle) {
- $out[] = $handle->renderLink();
- }
-
- return phutil_implode_html(phutil_tag('br'), $out);
- }
-
public function getRequiredDiffPropertiesForRevisionView() {
if ($this->getProxy()) {
return $this->getProxy()->getRequiredDiffPropertiesForRevisionView();
diff --git a/src/applications/releeph/field/specification/ReleephAuthorFieldSpecification.php b/src/applications/releeph/field/specification/ReleephAuthorFieldSpecification.php
--- a/src/applications/releeph/field/specification/ReleephAuthorFieldSpecification.php
+++ b/src/applications/releeph/field/specification/ReleephAuthorFieldSpecification.php
@@ -11,24 +11,23 @@
return 'Author';
}
- public function renderPropertyViewValue(array $handles) {
+ public function getRequiredHandlePHIDsForPropertyView() {
$pull = $this->getReleephRequest();
$commit = $pull->loadPhabricatorRepositoryCommit();
if (!$commit) {
- return null;
+ return array();
}
$author_phid = $commit->getAuthorPHID();
if (!$author_phid) {
- return null;
+ return array();
}
- $handle = id(new PhabricatorHandleQuery())
- ->setViewer($this->getUser())
- ->withPHIDs(array($author_phid))
- ->executeOne();
+ return array($author_phid);
+ }
- return $handle->renderLink();
+ public function renderPropertyViewValue(array $handles) {
+ return $this->renderHandleList($handles);
}
}
diff --git a/src/applications/releeph/field/specification/ReleephDependsOnFieldSpecification.php b/src/applications/releeph/field/specification/ReleephDependsOnFieldSpecification.php
--- a/src/applications/releeph/field/specification/ReleephDependsOnFieldSpecification.php
+++ b/src/applications/releeph/field/specification/ReleephDependsOnFieldSpecification.php
@@ -10,25 +10,12 @@
return pht('Depends On');
}
- public function renderPropertyViewValue(array $handles) {
- $revision_phids = $this->getDependentRevisionPHIDs();
- if (!$revision_phids) {
- return null;
- }
-
- $links = array();
- $handles = id(new PhabricatorHandleQuery())
- ->setViewer($this->getUser())
- ->withPHIDs($revision_phids)
- ->execute();
- foreach ($revision_phids as $revision_phid) {
- $links[] = id(clone $handles[$revision_phid])
- // Hack to remove the strike-through rendering of diff links
- ->setStatus(null)
- ->renderLink();
- }
+ public function getRequiredHandlePHIDsForPropertyView() {
+ return $this->getDependentRevisionPHIDs();
+ }
- return phutil_implode_html(phutil_tag('br'), $links);
+ public function renderPropertyViewValue(array $handles) {
+ return $this->renderHandleList($handles);
}
private function getDependentRevisionPHIDs() {
@@ -36,7 +23,7 @@
->getReleephRequest()
->loadDifferentialRevision();
if (!$revision) {
- return null;
+ return array();
}
return PhabricatorEdgeQuery::loadDestinationPHIDs(
diff --git a/src/applications/releeph/field/specification/ReleephDiffSizeFieldSpecification.php b/src/applications/releeph/field/specification/ReleephDiffSizeFieldSpecification.php
--- a/src/applications/releeph/field/specification/ReleephDiffSizeFieldSpecification.php
+++ b/src/applications/releeph/field/specification/ReleephDiffSizeFieldSpecification.php
@@ -18,7 +18,7 @@
public function renderPropertyViewValue(array $handles) {
$diff_rev = $this->getReleephRequest()->loadDifferentialRevision();
if (!$diff_rev) {
- return '';
+ return null;
}
$diffs = $diff_rev->loadRelatives(
diff --git a/src/applications/releeph/field/specification/ReleephFieldSpecification.php b/src/applications/releeph/field/specification/ReleephFieldSpecification.php
--- a/src/applications/releeph/field/specification/ReleephFieldSpecification.php
+++ b/src/applications/releeph/field/specification/ReleephFieldSpecification.php
@@ -30,14 +30,6 @@
return $value;
}
- public function slowlyLoadHandle($phid) {
- // TODO: Remove this, it's transitional as fields modernize.
- return id(new PhabricatorHandleQuery())
- ->withPHIDs(array($phid))
- ->setViewer($this->getUser())
- ->executeOne();
- }
-
abstract public function getName();
/* -( Storage )------------------------------------------------------------ */
diff --git a/src/applications/releeph/field/specification/ReleephIntentFieldSpecification.php b/src/applications/releeph/field/specification/ReleephIntentFieldSpecification.php
--- a/src/applications/releeph/field/specification/ReleephIntentFieldSpecification.php
+++ b/src/applications/releeph/field/specification/ReleephIntentFieldSpecification.php
@@ -11,6 +11,12 @@
return 'Intent';
}
+ public function getRequiredHandlePHIDsForPropertyView() {
+ $pull = $this->getReleephRequest();
+ $intents = $pull->getUserIntents();
+ return array_keys($intents);
+ }
+
public function renderPropertyViewValue(array $handles) {
$pull = $this->getReleephRequest();
@@ -21,16 +27,6 @@
return null;
}
- $user_phids = array_keys($intents);
- if ($user_phids) {
- $handles = id(new PhabricatorHandleQuery())
- ->withPHIDs($user_phids)
- ->setViewer(PhabricatorUser::getOmnipotentUser())
- ->execute();
- } else {
- $handles = array();
- }
-
$pushers = array();
$others = array();
diff --git a/src/applications/releeph/field/specification/ReleephOriginalCommitFieldSpecification.php b/src/applications/releeph/field/specification/ReleephOriginalCommitFieldSpecification.php
--- a/src/applications/releeph/field/specification/ReleephOriginalCommitFieldSpecification.php
+++ b/src/applications/releeph/field/specification/ReleephOriginalCommitFieldSpecification.php
@@ -11,9 +11,15 @@
return 'Commit';
}
+ public function getRequiredHandlePHIDsForPropertyView() {
+ return array(
+ $this->getReleephRequest()->getRequestCommitPHID(),
+ );
+ }
+
+
public function renderPropertyViewValue(array $handles) {
- $pull = $this->getReleephRequest();
- return $this->slowlyLoadHandle($pull->getRequestCommitPHID())->renderLink();
+ return $this->renderHandleList($handles);
}
}
diff --git a/src/applications/releeph/field/specification/ReleephRequestorFieldSpecification.php b/src/applications/releeph/field/specification/ReleephRequestorFieldSpecification.php
--- a/src/applications/releeph/field/specification/ReleephRequestorFieldSpecification.php
+++ b/src/applications/releeph/field/specification/ReleephRequestorFieldSpecification.php
@@ -11,13 +11,19 @@
return 'Requestor';
}
- public function renderPropertyViewValue(array $handles) {
+ public function getRequiredHandlePHIDsForPropertyView() {
+ $phids = array();
+
$phid = $this->getReleephRequest()->getRequestUserPHID();
- $handle = id(new PhabricatorHandleQuery())
- ->setViewer($this->getUser())
- ->withPHIDs(array($phid))
- ->executeOne();
- return $handle->renderLink();
+ if ($phid) {
+ $phids[] = $phid;
+ }
+
+ return $phids;
+ }
+
+ public function renderPropertyViewValue(array $handles) {
+ return $this->renderHandleList($handles);
}
public function shouldAppearOnCommitMessage() {
diff --git a/src/applications/releeph/field/specification/ReleephRevisionFieldSpecification.php b/src/applications/releeph/field/specification/ReleephRevisionFieldSpecification.php
--- a/src/applications/releeph/field/specification/ReleephRevisionFieldSpecification.php
+++ b/src/applications/releeph/field/specification/ReleephRevisionFieldSpecification.php
@@ -11,26 +11,19 @@
return 'Revision';
}
- public function renderPropertyViewValue(array $handles) {
- $phid = $this
- ->getReleephRequest()
- ->loadRequestCommitDiffPHID();
- if (!$phid) {
- return null;
+ public function getRequiredHandlePHIDsForPropertyView() {
+ $phids = array();
+
+ $phid = $this->getReleephRequest()->loadRequestCommitDiffPHID();
+ if ($phid) {
+ $phids[] = $phid;
}
- $handles = $this->getReleephRequest()->getHandles();
- $handle = $handles[$phid];
- $link = $handle
- // Hack to remove the strike-through rendering of diff links
- ->setStatus(null)
- ->renderLink();
- return phutil_tag(
- 'div',
- array(
- 'class' => 'releeph-header-text-truncated',
- ),
- $link);
+ return $phids;
+ }
+
+ public function renderPropertyViewValue(array $handles) {
+ return $this->renderHandleList($handles);
}
}
diff --git a/src/infrastructure/customfield/field/PhabricatorCustomField.php b/src/infrastructure/customfield/field/PhabricatorCustomField.php
--- a/src/infrastructure/customfield/field/PhabricatorCustomField.php
+++ b/src/infrastructure/customfield/field/PhabricatorCustomField.php
@@ -5,6 +5,7 @@
* @task core Core Properties and Field Identity
* @task proxy Field Proxies
* @task context Contextual Data
+ * @task render Rendering Utilities
* @task storage Field Storage
* @task edit Integration with Edit Views
* @task view Integration with Property Views
@@ -467,6 +468,26 @@
}
+/* -( Rendering Utilities )------------------------------------------------ */
+
+
+ /**
+ * @task render
+ */
+ protected function renderHandleList(array $handles) {
+ if (!$handles) {
+ return null;
+ }
+
+ $out = array();
+ foreach ($handles as $handle) {
+ $out[] = $handle->renderLink();
+ }
+
+ return phutil_implode_html(phutil_tag('br'), $out);
+ }
+
+
/* -( Storage )------------------------------------------------------------ */

File Metadata

Mime Type
text/plain
Expires
Sun, Oct 20, 11:28 PM (3 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6737621
Default Alt Text
D8810.id20909.diff (10 KB)

Event Timeline