Page MenuHomePhabricator

D8631.diff
No OneTemporary

D8631.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -2501,7 +2501,6 @@
'ReleephController' => 'applications/releeph/controller/ReleephController.php',
'ReleephDAO' => 'applications/releeph/storage/ReleephDAO.php',
'ReleephDefaultFieldSelector' => 'applications/releeph/field/selector/ReleephDefaultFieldSelector.php',
- 'ReleephDefaultUserView' => 'applications/releeph/view/user/ReleephDefaultUserView.php',
'ReleephDependsOnFieldSpecification' => 'applications/releeph/field/specification/ReleephDependsOnFieldSpecification.php',
'ReleephDiffChurnFieldSpecification' => 'applications/releeph/field/specification/ReleephDiffChurnFieldSpecification.php',
'ReleephDiffMessageFieldSpecification' => 'applications/releeph/field/specification/ReleephDiffMessageFieldSpecification.php',
@@ -2554,7 +2553,6 @@
'ReleephSeverityFieldSpecification' => 'applications/releeph/field/specification/ReleephSeverityFieldSpecification.php',
'ReleephStatusFieldSpecification' => 'applications/releeph/field/specification/ReleephStatusFieldSpecification.php',
'ReleephSummaryFieldSpecification' => 'applications/releeph/field/specification/ReleephSummaryFieldSpecification.php',
- 'ReleephUserView' => 'applications/releeph/view/user/ReleephUserView.php',
'ShellLogView' => 'applications/harbormaster/view/ShellLogView.php',
'SlowvoteEmbedView' => 'applications/slowvote/view/SlowvoteEmbedView.php',
'SlowvoteRemarkupRule' => 'applications/slowvote/remarkup/SlowvoteRemarkupRule.php',
@@ -5473,7 +5471,6 @@
'ReleephController' => 'PhabricatorController',
'ReleephDAO' => 'PhabricatorLiskDAO',
'ReleephDefaultFieldSelector' => 'ReleephFieldSelector',
- 'ReleephDefaultUserView' => 'ReleephUserView',
'ReleephDependsOnFieldSpecification' => 'ReleephFieldSpecification',
'ReleephDiffChurnFieldSpecification' => 'ReleephFieldSpecification',
'ReleephDiffMessageFieldSpecification' => 'ReleephFieldSpecification',
@@ -5545,7 +5542,6 @@
'ReleephSeverityFieldSpecification' => 'ReleephLevelFieldSpecification',
'ReleephStatusFieldSpecification' => 'ReleephFieldSpecification',
'ReleephSummaryFieldSpecification' => 'ReleephFieldSpecification',
- 'ReleephUserView' => 'AphrontView',
'ShellLogView' => 'AphrontView',
'SlowvoteEmbedView' => 'AphrontView',
'SlowvoteRemarkupRule' => 'PhabricatorRemarkupRuleObject',
diff --git a/src/applications/releeph/config/PhabricatorApplicationReleephConfigOptions.php b/src/applications/releeph/config/PhabricatorApplicationReleephConfigOptions.php
--- a/src/applications/releeph/config/PhabricatorApplicationReleephConfigOptions.php
+++ b/src/applications/releeph/config/PhabricatorApplicationReleephConfigOptions.php
@@ -60,18 +60,6 @@
$this->newOption('releeph.fields', $custom_field_type, $default)
->setCustomData('ReleephFieldSpecification'),
$this->newOption(
- 'releeph.user-view',
- 'class',
- 'ReleephDefaultUserView')
- ->setBaseClass('ReleephUserView')
- ->setSummary(pht('Extra markup when rendering usernames'))
- ->setDescription(
- pht(
- "A wrapper to render Phabricator users in Releeph, with custom ".
- "markup. For example, Facebook extends this to render additional ".
- "information about requestors, to each Releeph project's ".
- "pushers.")),
- $this->newOption(
'releeph.default-branch-template',
'string',
'releases/%P/%p-%Y%m%d-%v')
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
@@ -17,11 +17,6 @@
self::$authorMap[$releeph_request->getPHID()] = $author_phid;
}
}
-
- ReleephUserView::getNewInstance()
- ->setUser($this->getUser())
- ->setReleephProject($this->getReleephProject())
- ->load(self::$authorMap);
}
public function getName() {
@@ -32,9 +27,11 @@
$rr = $this->getReleephRequest();
$author_phid = idx(self::$authorMap, $rr->getPHID());
if ($author_phid) {
- return ReleephUserView::getNewInstance()
- ->setRenderUserPHID($author_phid)
- ->render();
+ $handle = id(new PhabricatorHandleQuery())
+ ->setViewer($this->getUser())
+ ->withPHIDs(array($author_phid))
+ ->executeOne();
+ return $handle->renderLink();
} else {
return 'Unknown Author';
}
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
@@ -7,23 +7,17 @@
return 'requestor';
}
- public function bulkLoad(array $releeph_requests) {
- $phids = mpull($releeph_requests, 'getRequestUserPHID');
- ReleephUserView::getNewInstance()
- ->setUser($this->getUser())
- ->setReleephProject($this->getReleephProject())
- ->load($phids);
- }
-
public function getName() {
return 'Requestor';
}
public function renderValueForHeaderView() {
$phid = $this->getReleephRequest()->getRequestUserPHID();
- return ReleephUserView::getNewInstance()
- ->setRenderUserPHID($phid)
- ->render();
+ $handle = id(new PhabricatorHandleQuery())
+ ->setViewer($this->getUser())
+ ->withPHIDs(array($phid))
+ ->executeOne();
+ return $handle->renderLink();
}
public function shouldAppearOnCommitMessage() {
diff --git a/src/applications/releeph/view/user/ReleephDefaultUserView.php b/src/applications/releeph/view/user/ReleephDefaultUserView.php
deleted file mode 100644
--- a/src/applications/releeph/view/user/ReleephDefaultUserView.php
+++ /dev/null
@@ -1,9 +0,0 @@
-<?php
-
-final class ReleephDefaultUserView extends ReleephUserView {
-
- public function render() {
- return $this->getHandle()->renderLink();
- }
-
-}
diff --git a/src/applications/releeph/view/user/ReleephUserView.php b/src/applications/releeph/view/user/ReleephUserView.php
deleted file mode 100644
--- a/src/applications/releeph/view/user/ReleephUserView.php
+++ /dev/null
@@ -1,75 +0,0 @@
-<?php
-
-abstract class ReleephUserView extends AphrontView {
-
- /**
- * This function should bulk load everything you need to render all the given
- * user phids.
- *
- * Many parts of Releeph load users for rendering. Accordingly, this
- * function will be called multiple times for each part of the UI that
- * renders users, so you should accumulate your results on each call.
- *
- * You should also implement render() (from AphrontView) to render each
- * user's PHID.
- */
- protected function loadInner(array $phids) {
- // This is a hook!
- }
-
- final public static function getNewInstance() {
- $key = 'releeph.user-view';
- $class = PhabricatorEnv::getEnvConfig($key);
- return newv($class, array());
- }
-
- private static $handles = array();
- private static $seen = array();
-
- final public function load(array $phids) {
- $todo = array();
-
- foreach ($phids as $key => $phid) {
- if (!idx(self::$seen, $phid)) {
- $todo[$key] = $phid;
- self::$seen[$phid] = true;
- }
- }
-
- if ($todo) {
- self::$handles = array_merge(
- self::$handles,
- id(new PhabricatorHandleQuery())
- ->setViewer($this->getUser())
- ->withPHIDs($todo)
- ->execute());
- $this->loadInner($todo);
- }
- }
-
- private $phid;
- private $releephProject;
-
- final public function setRenderUserPHID($phid) {
- $this->phid = $phid;
- return $this;
- }
-
- final public function setReleephProject(ReleephProject $project) {
- $this->releephProject = $project;
- return $this;
- }
-
- final protected function getRenderUserPHID() {
- return $this->phid;
- }
-
- final protected function getReleephProject() {
- return $this->releephProject;
- }
-
- final protected function getHandle() {
- return self::$handles[$this->phid];
- }
-
-}

File Metadata

Mime Type
text/plain
Expires
Wed, Apr 9, 2:37 PM (6 d, 11 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7708614
Default Alt Text
D8631.diff (8 KB)

Event Timeline