From 6c8cef3bee35b690da9341da22dbdb4d070eecfb Mon Sep 17 00:00:00 2001 From: epriestley Date: Sat, 29 Mar 2014 09:14:32 -0700 Subject: [PATCH] Remove ReleephUserView Summary: Fixes T3738. Facebook uses this to provide a couple of integrations (push karma, is user an intern?), but the mechanism is both very complex and not very general. Instead, these features are better implemented in Hovercards or via CustomField. We'll help Facebook integrate things when the time comes, but per discussion in T3738 none of this is critical or especially complicated. Test Plan: - Grepped for all callsites. - Viewed a request and verified that author/requestor populated and rendered correctly. Reviewers: btrahan, chad Reviewed By: chad Subscribers: epriestley Maniphest Tasks: T3738 Differential Revision: https://secure.phabricator.com/D8631 --- src/__phutil_library_map__.php | 4 - ...ricatorApplicationReleephConfigOptions.php | 12 --- .../ReleephAuthorFieldSpecification.php | 13 ++-- .../ReleephRequestorFieldSpecification.php | 16 ++-- .../view/user/ReleephDefaultUserView.php | 9 --- .../releeph/view/user/ReleephUserView.php | 75 ------------------- 6 files changed, 10 insertions(+), 119 deletions(-) delete mode 100644 src/applications/releeph/view/user/ReleephDefaultUserView.php delete mode 100644 src/applications/releeph/view/user/ReleephUserView.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 40c5e00249..0a5debf55c 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -2501,7 +2501,6 @@ phutil_register_library_map(array( '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 @@ phutil_register_library_map(array( '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 @@ phutil_register_library_map(array( 'ReleephController' => 'PhabricatorController', 'ReleephDAO' => 'PhabricatorLiskDAO', 'ReleephDefaultFieldSelector' => 'ReleephFieldSelector', - 'ReleephDefaultUserView' => 'ReleephUserView', 'ReleephDependsOnFieldSpecification' => 'ReleephFieldSpecification', 'ReleephDiffChurnFieldSpecification' => 'ReleephFieldSpecification', 'ReleephDiffMessageFieldSpecification' => 'ReleephFieldSpecification', @@ -5545,7 +5542,6 @@ phutil_register_library_map(array( '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 index 224711e6f3..d16416b935 100644 --- a/src/applications/releeph/config/PhabricatorApplicationReleephConfigOptions.php +++ b/src/applications/releeph/config/PhabricatorApplicationReleephConfigOptions.php @@ -59,18 +59,6 @@ final class PhabricatorApplicationReleephConfigOptions "stable.")), $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', diff --git a/src/applications/releeph/field/specification/ReleephAuthorFieldSpecification.php b/src/applications/releeph/field/specification/ReleephAuthorFieldSpecification.php index f2092263ac..1963fe0f8e 100644 --- a/src/applications/releeph/field/specification/ReleephAuthorFieldSpecification.php +++ b/src/applications/releeph/field/specification/ReleephAuthorFieldSpecification.php @@ -17,11 +17,6 @@ final class ReleephAuthorFieldSpecification 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 @@ final class ReleephAuthorFieldSpecification $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 index a6dd00b5d5..9bb4261470 100644 --- a/src/applications/releeph/field/specification/ReleephRequestorFieldSpecification.php +++ b/src/applications/releeph/field/specification/ReleephRequestorFieldSpecification.php @@ -7,23 +7,17 @@ final class ReleephRequestorFieldSpecification 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 index 93819cdad3..0000000000 --- a/src/applications/releeph/view/user/ReleephDefaultUserView.php +++ /dev/null @@ -1,9 +0,0 @@ -getHandle()->renderLink(); - } - -} diff --git a/src/applications/releeph/view/user/ReleephUserView.php b/src/applications/releeph/view/user/ReleephUserView.php deleted file mode 100644 index e09dc6d1da..0000000000 --- a/src/applications/releeph/view/user/ReleephUserView.php +++ /dev/null @@ -1,75 +0,0 @@ - $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]; - } - -}