2013-02-19 02:44:45 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorTokenGivenFeedStory
|
|
|
|
extends PhabricatorFeedStory {
|
|
|
|
|
|
|
|
public function getPrimaryObjectPHID() {
|
|
|
|
return $this->getValue('objectPHID');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getRequiredHandlePHIDs() {
|
|
|
|
$phids = array();
|
|
|
|
$phids[] = $this->getValue('objectPHID');
|
|
|
|
$phids[] = $this->getValue('authorPHID');
|
|
|
|
return $phids;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function renderView() {
|
|
|
|
$view = new PhabricatorFeedStoryView();
|
2013-04-13 18:09:42 +02:00
|
|
|
$view->setAppIcon('token-dark');
|
2013-02-19 02:44:45 +01:00
|
|
|
$view->setViewed($this->getHasViewed());
|
2013-04-13 18:09:42 +02:00
|
|
|
$author_phid = $this->getValue('authorPHID');
|
2013-02-19 02:44:45 +01:00
|
|
|
|
|
|
|
$href = $this->getHandle($this->getPrimaryObjectPHID())->getURI();
|
2013-02-21 23:24:53 +01:00
|
|
|
$view->setHref($href);
|
2013-02-19 02:44:45 +01:00
|
|
|
|
|
|
|
$title = pht(
|
|
|
|
'%s awarded %s a token.',
|
|
|
|
$this->linkTo($this->getValue('authorPHID')),
|
|
|
|
$this->linkTo($this->getValue('objectPHID')));
|
|
|
|
|
|
|
|
$view->setTitle($title);
|
2013-04-13 18:09:42 +02:00
|
|
|
$view->setImage($this->getHandle($author_phid)->getImageURI());
|
2013-02-19 02:44:45 +01:00
|
|
|
|
|
|
|
return $view;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function renderText() {
|
|
|
|
// TODO: This is grotesque; the feed notification handler relies on it.
|
|
|
|
return strip_tags($this->renderView()->render());
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|