Page MenuHomePhorge

No OneTemporary

diff --git a/src/applications/transactions/feed/PhabricatorApplicationTransactionFeedStory.php b/src/applications/transactions/feed/PhabricatorApplicationTransactionFeedStory.php
index 2ba820953c..9e529055d8 100644
--- a/src/applications/transactions/feed/PhabricatorApplicationTransactionFeedStory.php
+++ b/src/applications/transactions/feed/PhabricatorApplicationTransactionFeedStory.php
@@ -1,55 +1,62 @@
<?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() {
$view = new PHUIFeedStoryView();
$view->setViewed($this->getHasViewed());
- $href = $this->getHandle($this->getPrimaryObjectPHID())->getURI();
- $view->setHref($view);
+ $handle = $this->getHandle($this->getPrimaryObjectPHID());
+ $view->setHref($handle->getURI());
+ $view->setEpoch($this->getPrimaryTransaction()->getDateCreated());
+
+ $view->setAppIconFromPHID($handle->getPHID());
$xaction_phids = $this->getValue('transactionPHIDs');
$xaction = $this->getObject(head($xaction_phids));
$xaction->setHandles($this->getHandles());
$view->setTitle($xaction->getTitleForFeed());
+ $view->setImage(
+ $this->getHandle(
+ $this->getPrimaryTransaction()->getAuthorPHID())->getImageURI());
+
return $view;
}
public function renderText() {
// TODO: This is grotesque; the feed notification handler relies on it.
return strip_tags($this->renderView()->render());
}
}
diff --git a/src/view/phui/PHUIFeedStoryView.php b/src/view/phui/PHUIFeedStoryView.php
index 2df3fcfe86..d8f0eb9d4b 100644
--- a/src/view/phui/PHUIFeedStoryView.php
+++ b/src/view/phui/PHUIFeedStoryView.php
@@ -1,209 +1,220 @@
<?php
final class PHUIFeedStoryView extends AphrontView {
private $title;
private $image;
private $imageHref;
private $appIcon;
private $phid;
private $epoch;
private $viewed;
private $href;
private $pontification = null;
private $tokenBar = array();
private $projects = array();
private $actions = array();
public function setTitle($title) {
$this->title = $title;
return $this;
}
public function setEpoch($epoch) {
$this->epoch = $epoch;
return $this;
}
public function setImage($image) {
$this->image = $image;
return $this;
}
public function setImageHref($image_href) {
$this->imageHref = $image_href;
return $this;
}
public function setAppIcon($icon) {
$this->appIcon = $icon;
return $this;
}
public function setViewed($viewed) {
$this->viewed = $viewed;
return $this;
}
public function getViewed() {
return $this->viewed;
}
public function setHref($href) {
$this->href = $href;
return $this;
}
public function setTokenBar(array $tokens) {
$this->tokenBar = $tokens;
return $this;
}
public function addProject($project) {
$this->projects[] = $project;
return $this;
}
public function addAction(PHUIIconView $action) {
$this->actions[] = $action;
return $this;
}
public function setPontification($text, $title = null) {
if ($title) {
$title = phutil_tag('h3', array(), $title);
}
$copy = phutil_tag(
'div',
array(
'class' => 'phui-feed-story-bigtext-post',
),
array(
$title,
$text));
$this->appendChild($copy);
return $this;
}
public function getHref() {
return $this->href;
}
public function renderNotification() {
$classes = array(
'phabricator-notification',
);
if (!$this->viewed) {
$classes[] = 'phabricator-notification-unread';
}
return javelin_tag(
'div',
array(
'class' => implode(' ', $classes),
'sigil' => 'notification',
'meta' => array(
'href' => $this->getHref(),
),
),
$this->title);
}
public function render() {
require_celerity_resource('phui-feed-story-css');
$actor = '';
if ($this->image) {
$actor = new PHUIIconView();
$actor->setImage($this->image);
$actor->addClass('phui-feed-story-actor-image');
if ($this->imageHref) {
$actor->setHref($this->imageHref);
}
}
$action_list = array();
$icons = null;
foreach ($this->actions as $action) {
$action_list[] = phutil_tag(
'li',
array(
'class' => 'phui-feed-story-action-item'
),
$action);
}
if (!empty($action_list)) {
$icons = phutil_tag(
'ul',
array(
'class' => 'phui-feed-story-action-list'
),
$action_list);
}
$head = phutil_tag(
'div',
array(
'class' => 'phui-feed-story-head',
),
array(
$actor,
nonempty($this->title, pht('Untitled Story')),
$icons
));
$body = null;
$foot = null;
$image_style = null;
if (!empty($this->tokenBar)) {
$tokenview = phutil_tag(
'div',
array(
'class' => 'phui-feed-token-bar'
),
$this->tokenBar);
$this->appendChild($tokenview);
}
$body_content = $this->renderChildren();
if ($body_content) {
$body = phutil_tag(
'div',
array(
'class' => 'phui-feed-story-body',
),
$body_content);
}
if ($this->epoch) {
$foot = phabricator_datetime($this->epoch, $this->user);
} else {
$foot = pht('No time specified.');
}
$icon = null;
if ($this->appIcon) {
$icon = new PHUIIconView();
$icon->setSpriteIcon($this->appIcon);
$icon->setSpriteSheet(PHUIIconView::SPRITE_APPS);
}
$foot = phutil_tag(
'div',
array(
'class' => 'phui-feed-story-foot',
),
array(
$icon,
$foot));
return id(new PHUIBoxView())
->addClass('phui-feed-story')
->setShadow(true)
->addMargin(PHUI::MARGIN_MEDIUM_BOTTOM)
->appendChild(array($head, $body, $foot));
}
+
+ public function setAppIconFromPHID($phid) {
+ switch(phid_get_type($phid)) {
+ case PhabricatorPHIDConstants::PHID_TYPE_MOCK:
+ $this->setAppIcon("pholio-dark");
+ break;
+ case PhabricatorPHIDConstants::PHID_TYPE_MCRO:
+ $this->setAppIcon("macro-dark");
+ break;
+ }
+ }
}

File Metadata

Mime Type
text/x-diff
Expires
Jan 19 2025, 20:38 (6 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1128515
Default Alt Text
(7 KB)

Event Timeline