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;
|
|
|
|
}
|
|
|
|
|
2013-09-25 02:00:31 +02:00
|
|
|
public function getRequiredObjectPHIDs() {
|
|
|
|
$phids = array();
|
|
|
|
$phids[] = $this->getValue('tokenPHID');
|
|
|
|
return $phids;
|
|
|
|
}
|
|
|
|
|
2013-02-19 02:44:45 +01:00
|
|
|
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
|
|
|
|
2013-09-25 02:00:31 +02:00
|
|
|
$token = $this->getObject($this->getValue('tokenPHID'));
|
|
|
|
|
2013-02-19 02:44:45 +01:00
|
|
|
$title = pht(
|
2013-09-25 02:00:31 +02:00
|
|
|
'%s awarded %s a %s token.',
|
2013-02-19 02:44:45 +01:00
|
|
|
$this->linkTo($this->getValue('authorPHID')),
|
2013-09-25 02:00:31 +02:00
|
|
|
$this->linkTo($this->getValue('objectPHID')),
|
|
|
|
$token->getName());
|
2013-02-19 02:44:45 +01:00
|
|
|
|
|
|
|
$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.
|
2014-02-04 02:05:16 +01:00
|
|
|
return htmlspecialchars_decode(
|
|
|
|
strip_tags(
|
|
|
|
hsprintf(
|
|
|
|
'%s',
|
|
|
|
$this->renderView()->render())));
|
2013-02-19 02:44:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|