2012-12-11 23:00:21 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @concrete-extensible
|
|
|
|
*/
|
|
|
|
class PhabricatorApplicationTransactionFeedStory
|
|
|
|
extends PhabricatorFeedStory {
|
|
|
|
|
|
|
|
public function getPrimaryObjectPHID() {
|
|
|
|
return $this->getValue('objectPHID');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getRequiredObjectPHIDs() {
|
|
|
|
return array(
|
|
|
|
$this->getPrimaryTransactionPHID(),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getRequiredHandlePHIDs() {
|
|
|
|
$phids = array();
|
|
|
|
$phids[] = array($this->getValue('objectPHID'));
|
|
|
|
$phids[] = $this->getPrimaryTransaction()->getRequiredHandlePHIDs();
|
|
|
|
return array_mergev($phids);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getPrimaryTransactionPHID() {
|
|
|
|
return head($this->getValue('transactionPHIDs'));
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getPrimaryTransaction() {
|
|
|
|
return $this->getObject($this->getPrimaryTransactionPHID());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function renderView() {
|
2013-07-13 02:04:02 +02:00
|
|
|
$view = $this->newStoryView();
|
2012-12-11 23:00:21 +01:00
|
|
|
|
2013-05-26 16:54:29 +02:00
|
|
|
$handle = $this->getHandle($this->getPrimaryObjectPHID());
|
|
|
|
$view->setHref($handle->getURI());
|
|
|
|
|
|
|
|
$view->setAppIconFromPHID($handle->getPHID());
|
2012-12-11 23:00:21 +01:00
|
|
|
|
|
|
|
$xaction_phids = $this->getValue('transactionPHIDs');
|
|
|
|
$xaction = $this->getObject(head($xaction_phids));
|
|
|
|
|
|
|
|
$xaction->setHandles($this->getHandles());
|
|
|
|
$view->setTitle($xaction->getTitleForFeed());
|
2013-08-19 20:51:22 +02:00
|
|
|
$body = $xaction->getBodyForFeed($this);
|
|
|
|
if (nonempty($body)) {
|
|
|
|
$view->appendChild($body);
|
2013-08-05 19:10:33 +02:00
|
|
|
}
|
2012-12-11 23:00:21 +01:00
|
|
|
|
2013-05-26 16:54:29 +02:00
|
|
|
$view->setImage(
|
|
|
|
$this->getHandle(
|
|
|
|
$this->getPrimaryTransaction()->getAuthorPHID())->getImageURI());
|
|
|
|
|
2012-12-11 23:00:21 +01:00
|
|
|
return $view;
|
|
|
|
}
|
|
|
|
|
2013-02-16 02:10:51 +01:00
|
|
|
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-16 02:10:51 +01:00
|
|
|
}
|
|
|
|
|
2012-12-11 23:00:21 +01:00
|
|
|
}
|