@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+10 -119
-4
src/__phutil_library_map__.php
··· 2501 2501 'ReleephController' => 'applications/releeph/controller/ReleephController.php', 2502 2502 'ReleephDAO' => 'applications/releeph/storage/ReleephDAO.php', 2503 2503 'ReleephDefaultFieldSelector' => 'applications/releeph/field/selector/ReleephDefaultFieldSelector.php', 2504 - 'ReleephDefaultUserView' => 'applications/releeph/view/user/ReleephDefaultUserView.php', 2505 2504 'ReleephDependsOnFieldSpecification' => 'applications/releeph/field/specification/ReleephDependsOnFieldSpecification.php', 2506 2505 'ReleephDiffChurnFieldSpecification' => 'applications/releeph/field/specification/ReleephDiffChurnFieldSpecification.php', 2507 2506 'ReleephDiffMessageFieldSpecification' => 'applications/releeph/field/specification/ReleephDiffMessageFieldSpecification.php', ··· 2554 2553 'ReleephSeverityFieldSpecification' => 'applications/releeph/field/specification/ReleephSeverityFieldSpecification.php', 2555 2554 'ReleephStatusFieldSpecification' => 'applications/releeph/field/specification/ReleephStatusFieldSpecification.php', 2556 2555 'ReleephSummaryFieldSpecification' => 'applications/releeph/field/specification/ReleephSummaryFieldSpecification.php', 2557 - 'ReleephUserView' => 'applications/releeph/view/user/ReleephUserView.php', 2558 2556 'ShellLogView' => 'applications/harbormaster/view/ShellLogView.php', 2559 2557 'SlowvoteEmbedView' => 'applications/slowvote/view/SlowvoteEmbedView.php', 2560 2558 'SlowvoteRemarkupRule' => 'applications/slowvote/remarkup/SlowvoteRemarkupRule.php', ··· 5473 5471 'ReleephController' => 'PhabricatorController', 5474 5472 'ReleephDAO' => 'PhabricatorLiskDAO', 5475 5473 'ReleephDefaultFieldSelector' => 'ReleephFieldSelector', 5476 - 'ReleephDefaultUserView' => 'ReleephUserView', 5477 5474 'ReleephDependsOnFieldSpecification' => 'ReleephFieldSpecification', 5478 5475 'ReleephDiffChurnFieldSpecification' => 'ReleephFieldSpecification', 5479 5476 'ReleephDiffMessageFieldSpecification' => 'ReleephFieldSpecification', ··· 5545 5542 'ReleephSeverityFieldSpecification' => 'ReleephLevelFieldSpecification', 5546 5543 'ReleephStatusFieldSpecification' => 'ReleephFieldSpecification', 5547 5544 'ReleephSummaryFieldSpecification' => 'ReleephFieldSpecification', 5548 - 'ReleephUserView' => 'AphrontView', 5549 5545 'ShellLogView' => 'AphrontView', 5550 5546 'SlowvoteEmbedView' => 'AphrontView', 5551 5547 'SlowvoteRemarkupRule' => 'PhabricatorRemarkupRuleObject',
-12
src/applications/releeph/config/PhabricatorApplicationReleephConfigOptions.php
··· 60 60 $this->newOption('releeph.fields', $custom_field_type, $default) 61 61 ->setCustomData('ReleephFieldSpecification'), 62 62 $this->newOption( 63 - 'releeph.user-view', 64 - 'class', 65 - 'ReleephDefaultUserView') 66 - ->setBaseClass('ReleephUserView') 67 - ->setSummary(pht('Extra markup when rendering usernames')) 68 - ->setDescription( 69 - pht( 70 - "A wrapper to render Phabricator users in Releeph, with custom ". 71 - "markup. For example, Facebook extends this to render additional ". 72 - "information about requestors, to each Releeph project's ". 73 - "pushers.")), 74 - $this->newOption( 75 63 'releeph.default-branch-template', 76 64 'string', 77 65 'releases/%P/%p-%Y%m%d-%v')
+5 -8
src/applications/releeph/field/specification/ReleephAuthorFieldSpecification.php
··· 17 17 self::$authorMap[$releeph_request->getPHID()] = $author_phid; 18 18 } 19 19 } 20 - 21 - ReleephUserView::getNewInstance() 22 - ->setUser($this->getUser()) 23 - ->setReleephProject($this->getReleephProject()) 24 - ->load(self::$authorMap); 25 20 } 26 21 27 22 public function getName() { ··· 32 27 $rr = $this->getReleephRequest(); 33 28 $author_phid = idx(self::$authorMap, $rr->getPHID()); 34 29 if ($author_phid) { 35 - return ReleephUserView::getNewInstance() 36 - ->setRenderUserPHID($author_phid) 37 - ->render(); 30 + $handle = id(new PhabricatorHandleQuery()) 31 + ->setViewer($this->getUser()) 32 + ->withPHIDs(array($author_phid)) 33 + ->executeOne(); 34 + return $handle->renderLink(); 38 35 } else { 39 36 return 'Unknown Author'; 40 37 }
+5 -11
src/applications/releeph/field/specification/ReleephRequestorFieldSpecification.php
··· 7 7 return 'requestor'; 8 8 } 9 9 10 - public function bulkLoad(array $releeph_requests) { 11 - $phids = mpull($releeph_requests, 'getRequestUserPHID'); 12 - ReleephUserView::getNewInstance() 13 - ->setUser($this->getUser()) 14 - ->setReleephProject($this->getReleephProject()) 15 - ->load($phids); 16 - } 17 - 18 10 public function getName() { 19 11 return 'Requestor'; 20 12 } 21 13 22 14 public function renderValueForHeaderView() { 23 15 $phid = $this->getReleephRequest()->getRequestUserPHID(); 24 - return ReleephUserView::getNewInstance() 25 - ->setRenderUserPHID($phid) 26 - ->render(); 16 + $handle = id(new PhabricatorHandleQuery()) 17 + ->setViewer($this->getUser()) 18 + ->withPHIDs(array($phid)) 19 + ->executeOne(); 20 + return $handle->renderLink(); 27 21 } 28 22 29 23 public function shouldAppearOnCommitMessage() {
-9
src/applications/releeph/view/user/ReleephDefaultUserView.php
··· 1 - <?php 2 - 3 - final class ReleephDefaultUserView extends ReleephUserView { 4 - 5 - public function render() { 6 - return $this->getHandle()->renderLink(); 7 - } 8 - 9 - }
-75
src/applications/releeph/view/user/ReleephUserView.php
··· 1 - <?php 2 - 3 - abstract class ReleephUserView extends AphrontView { 4 - 5 - /** 6 - * This function should bulk load everything you need to render all the given 7 - * user phids. 8 - * 9 - * Many parts of Releeph load users for rendering. Accordingly, this 10 - * function will be called multiple times for each part of the UI that 11 - * renders users, so you should accumulate your results on each call. 12 - * 13 - * You should also implement render() (from AphrontView) to render each 14 - * user's PHID. 15 - */ 16 - protected function loadInner(array $phids) { 17 - // This is a hook! 18 - } 19 - 20 - final public static function getNewInstance() { 21 - $key = 'releeph.user-view'; 22 - $class = PhabricatorEnv::getEnvConfig($key); 23 - return newv($class, array()); 24 - } 25 - 26 - private static $handles = array(); 27 - private static $seen = array(); 28 - 29 - final public function load(array $phids) { 30 - $todo = array(); 31 - 32 - foreach ($phids as $key => $phid) { 33 - if (!idx(self::$seen, $phid)) { 34 - $todo[$key] = $phid; 35 - self::$seen[$phid] = true; 36 - } 37 - } 38 - 39 - if ($todo) { 40 - self::$handles = array_merge( 41 - self::$handles, 42 - id(new PhabricatorHandleQuery()) 43 - ->setViewer($this->getUser()) 44 - ->withPHIDs($todo) 45 - ->execute()); 46 - $this->loadInner($todo); 47 - } 48 - } 49 - 50 - private $phid; 51 - private $releephProject; 52 - 53 - final public function setRenderUserPHID($phid) { 54 - $this->phid = $phid; 55 - return $this; 56 - } 57 - 58 - final public function setReleephProject(ReleephProject $project) { 59 - $this->releephProject = $project; 60 - return $this; 61 - } 62 - 63 - final protected function getRenderUserPHID() { 64 - return $this->phid; 65 - } 66 - 67 - final protected function getReleephProject() { 68 - return $this->releephProject; 69 - } 70 - 71 - final protected function getHandle() { 72 - return self::$handles[$this->phid]; 73 - } 74 - 75 - }