From 9a9e556ca76dabfc61de0726209aba6dd29206a5 Mon Sep 17 00:00:00 2001 From: Gareth Evans Date: Sun, 26 May 2013 07:54:29 -0700 Subject: [PATCH] Set some more data on PhabricatorApplicationTransactionFeedStory Summary: Kind of just guessed what to do here. It seemed reasonable. Take the transaction, use the author to get an actor image. Get the main object handle type, use that for the app icon. Use the transaction's created date as a time. Ref T2988 @chad I think there's still no icon for mock? Test Plan: Look at my feed. See some info. Reviewers: epriestley, chad Reviewed By: epriestley CC: chad, aran, epriestley, Korvin Maniphest Tasks: T2988 Differential Revision: https://secure.phabricator.com/D6044 --- .../PhabricatorApplicationTransactionFeedStory.php | 11 +++++++++-- src/view/phui/PHUIFeedStoryView.php | 11 +++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) 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 @@ -35,8 +35,11 @@ class PhabricatorApplicationTransactionFeedStory $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)); @@ -44,6 +47,10 @@ class PhabricatorApplicationTransactionFeedStory $xaction->setHandles($this->getHandles()); $view->setTitle($xaction->getTitleForFeed()); + $view->setImage( + $this->getHandle( + $this->getPrimaryTransaction()->getAuthorPHID())->getImageURI()); + return $view; } 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 @@ -206,4 +206,15 @@ final class PHUIFeedStoryView extends AphrontView { ->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; + } + } }