From 57f1a834886198c0b6ab5487c64b04feab2c2677 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Wed, 22 Jan 2014 20:09:32 -0800 Subject: [PATCH] Add dates to notifications page Summary: Fixes T3957, adds timestamps to the notifications page. Test Plan: View my notifications page, see the new time stamps. Uncertain if I set $user correctly. Reviewers: epriestley, btrahan Reviewed By: btrahan CC: Korvin, epriestley, aran Maniphest Tasks: T3957 Differential Revision: https://secure.phabricator.com/D8039 --- resources/celerity/map.php | 6 +++--- .../builder/PhabricatorNotificationBuilder.php | 9 +++++++-- .../PhabricatorNotificationListController.php | 1 + src/view/phui/PHUIFeedStoryView.php | 18 ++++++++++++++++-- .../css/application/base/notification-menu.css | 5 +++++ 5 files changed, 32 insertions(+), 7 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index f5b3d0ae12..aff4b614f5 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -7,7 +7,7 @@ return array( 'names' => array( - 'core.pkg.css' => '2eafddad', + 'core.pkg.css' => '6c70dd0e', 'core.pkg.js' => 'c907bd96', 'darkconsole.pkg.js' => 'ca8671ce', 'differential.pkg.css' => '5a65a762', @@ -40,7 +40,7 @@ return array( 'rsrc/css/aphront/typeahead.css' => '00c9a200', 'rsrc/css/application/auth/auth.css' => '1e655982', 'rsrc/css/application/base/main-menu-view.css' => 'aba0b7a6', - 'rsrc/css/application/base/notification-menu.css' => '07433791', + 'rsrc/css/application/base/notification-menu.css' => 'fc9a363c', 'rsrc/css/application/base/phabricator-application-launch-view.css' => '6f8453d9', 'rsrc/css/application/base/standard-page-view.css' => '517cdfb1', 'rsrc/css/application/chatlog/chatlog.css' => '0cd2bc78', @@ -693,7 +693,7 @@ return array( 'phabricator-nav-view-css' => 'd0d4a509', 'phabricator-notification' => '95944043', 'phabricator-notification-css' => '6901121e', - 'phabricator-notification-menu-css' => '07433791', + 'phabricator-notification-menu-css' => 'fc9a363c', 'phabricator-object-list-view-css' => '1a1ea560', 'phabricator-object-selector-css' => '029a133d', 'phabricator-phtize' => 'd254d646', diff --git a/src/applications/notification/builder/PhabricatorNotificationBuilder.php b/src/applications/notification/builder/PhabricatorNotificationBuilder.php index c0687799f8..c3fa3d5426 100644 --- a/src/applications/notification/builder/PhabricatorNotificationBuilder.php +++ b/src/applications/notification/builder/PhabricatorNotificationBuilder.php @@ -3,11 +3,17 @@ final class PhabricatorNotificationBuilder { private $stories; + private $user = null; public function __construct(array $stories) { $this->stories = $stories; } + public function setUser($user) { + $this->user = $user; + return $this; + } + public function buildView() { $stories = $this->stories; @@ -124,8 +130,7 @@ final class PhabricatorNotificationBuilder { foreach ($stories as $story) { $view = $story->renderView(); - - $null_view->appendChild($view->renderNotification()); + $null_view->appendChild($view->renderNotification($this->user)); } return $null_view; diff --git a/src/applications/notification/controller/PhabricatorNotificationListController.php b/src/applications/notification/controller/PhabricatorNotificationListController.php index 9a61d17920..e9cb0f2076 100644 --- a/src/applications/notification/controller/PhabricatorNotificationListController.php +++ b/src/applications/notification/controller/PhabricatorNotificationListController.php @@ -43,6 +43,7 @@ final class PhabricatorNotificationListController if ($notifications) { $builder = new PhabricatorNotificationBuilder($notifications); + $builder->setUser($user); $view = $builder->buildView()->render(); } else { $view = phutil_tag_div( diff --git a/src/view/phui/PHUIFeedStoryView.php b/src/view/phui/PHUIFeedStoryView.php index 008c286e49..3b9183dab9 100644 --- a/src/view/phui/PHUIFeedStoryView.php +++ b/src/view/phui/PHUIFeedStoryView.php @@ -99,7 +99,7 @@ final class PHUIFeedStoryView extends AphrontView { return $this->href; } - public function renderNotification() { + public function renderNotification($user) { $classes = array( 'phabricator-notification', ); @@ -107,6 +107,20 @@ final class PHUIFeedStoryView extends AphrontView { if (!$this->viewed) { $classes[] = 'phabricator-notification-unread'; } + if ($this->epoch) { + if ($user) { + $foot = phabricator_datetime($this->epoch, $user); + $foot = phutil_tag( + 'span', + array( + 'class' => 'phabricator-notification-date'), + $foot); + } else { + $foot = null; + } + } else { + $foot = pht('No time specified.'); + } return javelin_tag( 'div', @@ -117,7 +131,7 @@ final class PHUIFeedStoryView extends AphrontView { 'href' => $this->getHref(), ), ), - $this->title); + array($this->title, $foot)); } public function render() { diff --git a/webroot/rsrc/css/application/base/notification-menu.css b/webroot/rsrc/css/application/base/notification-menu.css index 084ec01f97..fe3f77ad62 100644 --- a/webroot/rsrc/css/application/base/notification-menu.css +++ b/webroot/rsrc/css/application/base/notification-menu.css @@ -13,6 +13,11 @@ border-radius: 3px; } +.phabricator-notification .phabricator-notification-date { + margin-left: 8px; + color: {$lightgreytext}; +} + .phabricator-notification-menu-loading { text-align: center; padding: 10px 0;