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() {
|
2013-07-13 02:04:02 +02:00
|
|
|
$view = $this->newStoryView();
|
2013-04-13 18:09:42 +02:00
|
|
|
$view->setAppIcon('token-dark');
|
|
|
|
$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.
|
2013-08-13 19:11:47 +02:00
|
|
|
return strip_tags(hsprintf('%s', $this->renderView()->render()));
|
2013-02-19 02:44:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|