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

at recaptime-dev/main 78 lines 1.8 kB view raw
1<?php 2 3final class DifferentialRepositoryField 4 extends DifferentialCoreCustomField { 5 6 public function getFieldKey() { 7 return 'differential:repository'; 8 } 9 10 public function getFieldName() { 11 return pht('Repository'); 12 } 13 14 public function getFieldDescription() { 15 return pht('Associates a revision with a repository.'); 16 } 17 18 protected function readValueFromRevision( 19 DifferentialRevision $revision) { 20 return $revision->getRepositoryPHID(); 21 } 22 23 public function shouldAppearInPropertyView() { 24 return true; 25 } 26 27 public function renderPropertyViewValue(array $handles) { 28 return null; 29 } 30 31 public function shouldAppearInDiffPropertyView() { 32 return true; 33 } 34 35 public function renderDiffPropertyViewLabel(DifferentialDiff $diff) { 36 return $this->getFieldName(); 37 } 38 39 public function renderDiffPropertyViewValue(DifferentialDiff $diff) { 40 if (!$diff->getRepositoryPHID()) { 41 return null; 42 } 43 44 return $this->getViewer()->renderHandle($diff->getRepositoryPHID()); 45 } 46 47 public function shouldAppearInTransactionMail() { 48 return true; 49 } 50 51 public function updateTransactionMailBody( 52 PhabricatorMetaMTAMailBody $body, 53 PhabricatorApplicationTransactionEditor $editor, 54 array $xactions) { 55 56 $repository = $this->getObject()->getRepository(); 57 if ($repository === null) { 58 return; 59 } 60 61 $body->addTextSection( 62 pht('REPOSITORY'), 63 $repository->getMonogram().' '.$repository->getName()); 64 } 65 66 public function shouldAppearInListView() { 67 return true; 68 } 69 70 public function renderOnListItem(PHUIObjectItemView $view) { 71 if ($this->getValue()) { 72 $handle = $this->getViewer()->renderHandle($this->getValue()); 73 $view->addByLine(pht('Repository: %s', $handle)); 74 } 75 } 76 77 78}