[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhabricatorTokenGivenFeedStory 4 extends PhabricatorFeedStory { 5 6 public function getPrimaryObjectPHID() { 7 return $this->getValue('objectPHID'); 8 } 9 10 public function getRequiredHandlePHIDs() { 11 $phids = array(); 12 $phids[] = $this->getValue('objectPHID'); 13 $phids[] = $this->getValue('authorPHID'); 14 return $phids; 15 } 16 17 public function getRequiredObjectPHIDs() { 18 $phids = array(); 19 $phids[] = $this->getValue('tokenPHID'); 20 return $phids; 21 } 22 23 public function renderView() { 24 $view = $this->newStoryView(); 25 $view->setAppIcon('token-dark'); 26 $author_phid = $this->getValue('authorPHID'); 27 28 $href = $this->getHandle($this->getPrimaryObjectPHID())->getURI(); 29 $view->setHref($href); 30 31 $view->setTitle($this->renderTitle()); 32 $view->setImage($this->getHandle($author_phid)->getImageURI()); 33 34 return $view; 35 } 36 37 private function renderTitle() { 38 $token = $this->getObject($this->getValue('tokenPHID')); 39 $title = pht( 40 '%s awarded %s a %s token.', 41 $this->linkTo($this->getValue('authorPHID')), 42 $this->linkTo($this->getValue('objectPHID')), 43 $token->getName()); 44 45 return $title; 46 } 47 48 public function renderText() { 49 $old_target = $this->getRenderingTarget(); 50 $this->setRenderingTarget(PhabricatorApplicationTransaction::TARGET_TEXT); 51 $title = $this->renderTitle(); 52 $this->setRenderingTarget($old_target); 53 return $title; 54 } 55 56 public function renderAsTextForDoorkeeper( 57 DoorkeeperFeedStoryPublisher $publisher) { 58 // TODO: This is slightly wrong, as it does not respect implied context 59 // on the publisher, so it will always say "awarded D123 a token" when it 60 // should sometimes say "awarded this revision a token". 61 return $this->renderText(); 62 } 63 64 65 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |