@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.

Use standard handle loading in Releeph

Summary: Ref T3718. Move from unbatched / ad-hoc loading to standard stuff for handles.

Test Plan: Looked at some requests and saw no changes.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T3718

Differential Revision: https://secure.phabricator.com/D8810

+72 -85
-13
src/applications/differential/customfield/DifferentialCustomField.php
··· 31 31 return parent::shouldEnableForRole($role); 32 32 } 33 33 34 - protected function renderHandleList(array $handles) { 35 - if (!$handles) { 36 - return null; 37 - } 38 - 39 - $out = array(); 40 - foreach ($handles as $handle) { 41 - $out[] = $handle->renderLink(); 42 - } 43 - 44 - return phutil_implode_html(phutil_tag('br'), $out); 45 - } 46 - 47 34 public function getRequiredDiffPropertiesForRevisionView() { 48 35 if ($this->getProxy()) { 49 36 return $this->getProxy()->getRequiredDiffPropertiesForRevisionView();
+7 -8
src/applications/releeph/field/specification/ReleephAuthorFieldSpecification.php
··· 11 11 return 'Author'; 12 12 } 13 13 14 - public function renderPropertyViewValue(array $handles) { 14 + public function getRequiredHandlePHIDsForPropertyView() { 15 15 $pull = $this->getReleephRequest(); 16 16 $commit = $pull->loadPhabricatorRepositoryCommit(); 17 17 if (!$commit) { 18 - return null; 18 + return array(); 19 19 } 20 20 21 21 $author_phid = $commit->getAuthorPHID(); 22 22 if (!$author_phid) { 23 - return null; 23 + return array(); 24 24 } 25 25 26 - $handle = id(new PhabricatorHandleQuery()) 27 - ->setViewer($this->getUser()) 28 - ->withPHIDs(array($author_phid)) 29 - ->executeOne(); 26 + return array($author_phid); 27 + } 30 28 31 - return $handle->renderLink(); 29 + public function renderPropertyViewValue(array $handles) { 30 + return $this->renderHandleList($handles); 32 31 } 33 32 34 33 }
+6 -19
src/applications/releeph/field/specification/ReleephDependsOnFieldSpecification.php
··· 10 10 return pht('Depends On'); 11 11 } 12 12 13 + public function getRequiredHandlePHIDsForPropertyView() { 14 + return $this->getDependentRevisionPHIDs(); 15 + } 16 + 13 17 public function renderPropertyViewValue(array $handles) { 14 - $revision_phids = $this->getDependentRevisionPHIDs(); 15 - if (!$revision_phids) { 16 - return null; 17 - } 18 - 19 - $links = array(); 20 - $handles = id(new PhabricatorHandleQuery()) 21 - ->setViewer($this->getUser()) 22 - ->withPHIDs($revision_phids) 23 - ->execute(); 24 - foreach ($revision_phids as $revision_phid) { 25 - $links[] = id(clone $handles[$revision_phid]) 26 - // Hack to remove the strike-through rendering of diff links 27 - ->setStatus(null) 28 - ->renderLink(); 29 - } 30 - 31 - return phutil_implode_html(phutil_tag('br'), $links); 18 + return $this->renderHandleList($handles); 32 19 } 33 20 34 21 private function getDependentRevisionPHIDs() { ··· 36 23 ->getReleephRequest() 37 24 ->loadDifferentialRevision(); 38 25 if (!$revision) { 39 - return null; 26 + return array(); 40 27 } 41 28 42 29 return PhabricatorEdgeQuery::loadDestinationPHIDs(
+1 -1
src/applications/releeph/field/specification/ReleephDiffSizeFieldSpecification.php
··· 18 18 public function renderPropertyViewValue(array $handles) { 19 19 $diff_rev = $this->getReleephRequest()->loadDifferentialRevision(); 20 20 if (!$diff_rev) { 21 - return ''; 21 + return null; 22 22 } 23 23 24 24 $diffs = $diff_rev->loadRelatives(
-8
src/applications/releeph/field/specification/ReleephFieldSpecification.php
··· 30 30 return $value; 31 31 } 32 32 33 - public function slowlyLoadHandle($phid) { 34 - // TODO: Remove this, it's transitional as fields modernize. 35 - return id(new PhabricatorHandleQuery()) 36 - ->withPHIDs(array($phid)) 37 - ->setViewer($this->getUser()) 38 - ->executeOne(); 39 - } 40 - 41 33 abstract public function getName(); 42 34 43 35 /* -( Storage )------------------------------------------------------------ */
+6 -10
src/applications/releeph/field/specification/ReleephIntentFieldSpecification.php
··· 11 11 return 'Intent'; 12 12 } 13 13 14 + public function getRequiredHandlePHIDsForPropertyView() { 15 + $pull = $this->getReleephRequest(); 16 + $intents = $pull->getUserIntents(); 17 + return array_keys($intents); 18 + } 19 + 14 20 public function renderPropertyViewValue(array $handles) { 15 21 $pull = $this->getReleephRequest(); 16 22 ··· 19 25 20 26 if (!$intents) { 21 27 return null; 22 - } 23 - 24 - $user_phids = array_keys($intents); 25 - if ($user_phids) { 26 - $handles = id(new PhabricatorHandleQuery()) 27 - ->withPHIDs($user_phids) 28 - ->setViewer(PhabricatorUser::getOmnipotentUser()) 29 - ->execute(); 30 - } else { 31 - $handles = array(); 32 28 } 33 29 34 30 $pushers = array();
+8 -2
src/applications/releeph/field/specification/ReleephOriginalCommitFieldSpecification.php
··· 11 11 return 'Commit'; 12 12 } 13 13 14 + public function getRequiredHandlePHIDsForPropertyView() { 15 + return array( 16 + $this->getReleephRequest()->getRequestCommitPHID(), 17 + ); 18 + } 19 + 20 + 14 21 public function renderPropertyViewValue(array $handles) { 15 - $pull = $this->getReleephRequest(); 16 - return $this->slowlyLoadHandle($pull->getRequestCommitPHID())->renderLink(); 22 + return $this->renderHandleList($handles); 17 23 } 18 24 19 25 }
+12 -6
src/applications/releeph/field/specification/ReleephRequestorFieldSpecification.php
··· 11 11 return 'Requestor'; 12 12 } 13 13 14 - public function renderPropertyViewValue(array $handles) { 14 + public function getRequiredHandlePHIDsForPropertyView() { 15 + $phids = array(); 16 + 15 17 $phid = $this->getReleephRequest()->getRequestUserPHID(); 16 - $handle = id(new PhabricatorHandleQuery()) 17 - ->setViewer($this->getUser()) 18 - ->withPHIDs(array($phid)) 19 - ->executeOne(); 20 - return $handle->renderLink(); 18 + if ($phid) { 19 + $phids[] = $phid; 20 + } 21 + 22 + return $phids; 23 + } 24 + 25 + public function renderPropertyViewValue(array $handles) { 26 + return $this->renderHandleList($handles); 21 27 } 22 28 23 29 public function shouldAppearOnCommitMessage() {
+11 -18
src/applications/releeph/field/specification/ReleephRevisionFieldSpecification.php
··· 11 11 return 'Revision'; 12 12 } 13 13 14 - public function renderPropertyViewValue(array $handles) { 15 - $phid = $this 16 - ->getReleephRequest() 17 - ->loadRequestCommitDiffPHID(); 18 - if (!$phid) { 19 - return null; 14 + public function getRequiredHandlePHIDsForPropertyView() { 15 + $phids = array(); 16 + 17 + $phid = $this->getReleephRequest()->loadRequestCommitDiffPHID(); 18 + if ($phid) { 19 + $phids[] = $phid; 20 20 } 21 21 22 - $handles = $this->getReleephRequest()->getHandles(); 23 - $handle = $handles[$phid]; 24 - $link = $handle 25 - // Hack to remove the strike-through rendering of diff links 26 - ->setStatus(null) 27 - ->renderLink(); 28 - return phutil_tag( 29 - 'div', 30 - array( 31 - 'class' => 'releeph-header-text-truncated', 32 - ), 33 - $link); 22 + return $phids; 23 + } 24 + 25 + public function renderPropertyViewValue(array $handles) { 26 + return $this->renderHandleList($handles); 34 27 } 35 28 36 29 }
+21
src/infrastructure/customfield/field/PhabricatorCustomField.php
··· 5 5 * @task core Core Properties and Field Identity 6 6 * @task proxy Field Proxies 7 7 * @task context Contextual Data 8 + * @task render Rendering Utilities 8 9 * @task storage Field Storage 9 10 * @task edit Integration with Edit Views 10 11 * @task view Integration with Property Views ··· 464 465 throw new PhabricatorCustomFieldDataNotAvailableException($this); 465 466 } 466 467 return $this->viewer; 468 + } 469 + 470 + 471 + /* -( Rendering Utilities )------------------------------------------------ */ 472 + 473 + 474 + /** 475 + * @task render 476 + */ 477 + protected function renderHandleList(array $handles) { 478 + if (!$handles) { 479 + return null; 480 + } 481 + 482 + $out = array(); 483 + foreach ($handles as $handle) { 484 + $out[] = $handle->renderLink(); 485 + } 486 + 487 + return phutil_implode_html(phutil_tag('br'), $out); 467 488 } 468 489 469 490