From bd6d300282ec5d3e39fa2098997a62c9078778bb Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 8 Jul 2016 07:38:37 -0700 Subject: [PATCH] Strip timestamps from popup notification bubbles Summary: Fixes T11097. Currently, popup notifications show a useless timestamp with the current time, after D16041 made some things more consistent. Strip these from the popup bubbles. Test Plan: - Saw a popup bubble, no timestamp. - Viewed main notification list, saw timestamps. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11097 Differential Revision: https://secure.phabricator.com/D16258 --- .../PhabricatorNotificationBuilder.php | 13 +++++++ ...icatorNotificationIndividualController.php | 3 +- src/view/phui/PHUIFeedStoryView.php | 37 +++++++++++++------ 3 files changed, 41 insertions(+), 12 deletions(-) diff --git a/src/applications/notification/builder/PhabricatorNotificationBuilder.php b/src/applications/notification/builder/PhabricatorNotificationBuilder.php index a8af4ff00e..12e4b57bfb 100644 --- a/src/applications/notification/builder/PhabricatorNotificationBuilder.php +++ b/src/applications/notification/builder/PhabricatorNotificationBuilder.php @@ -5,6 +5,7 @@ final class PhabricatorNotificationBuilder extends Phobject { private $stories; private $parsedStories; private $user = null; + private $showTimestamps = true; public function __construct(array $stories) { assert_instances_of($stories, 'PhabricatorFeedStory'); @@ -16,6 +17,15 @@ final class PhabricatorNotificationBuilder extends Phobject { return $this; } + public function setShowTimestamps($show_timestamps) { + $this->showTimestamps = $show_timestamps; + return $this; + } + + public function getShowTimestamps() { + return $this->showTimestamps; + } + private function parseStories() { if ($this->parsedStories) { @@ -121,6 +131,9 @@ final class PhabricatorNotificationBuilder extends Phobject { // TODO: Render a nice debuggable notice instead? continue; } + + $view->setShowTimestamp($this->getShowTimestamps()); + $null_view->appendChild($view->renderNotification($this->user)); } diff --git a/src/applications/notification/controller/PhabricatorNotificationIndividualController.php b/src/applications/notification/controller/PhabricatorNotificationIndividualController.php index bfaebaf606..41dade2747 100644 --- a/src/applications/notification/controller/PhabricatorNotificationIndividualController.php +++ b/src/applications/notification/controller/PhabricatorNotificationIndividualController.php @@ -31,7 +31,8 @@ final class PhabricatorNotificationIndividualController } $builder = id(new PhabricatorNotificationBuilder(array($story))) - ->setUser($viewer); + ->setUser($viewer) + ->setShowTimestamps(false); $content = $builder->buildView()->render(); $dict = $builder->buildDict(); diff --git a/src/view/phui/PHUIFeedStoryView.php b/src/view/phui/PHUIFeedStoryView.php index 8267fa0197..fbba4a3f46 100644 --- a/src/view/phui/PHUIFeedStoryView.php +++ b/src/view/phui/PHUIFeedStoryView.php @@ -17,6 +17,7 @@ final class PHUIFeedStoryView extends AphrontView { private $chronologicalKey; private $tags; private $authorIcon; + private $showTimestamp = true; public function setTags($tags) { $this->tags = $tags; @@ -97,6 +98,15 @@ final class PHUIFeedStoryView extends AphrontView { return $this; } + public function setShowTimestamp($show_timestamp) { + $this->showTimestamp = $show_timestamp; + return $this; + } + + public function getShowTimestamp() { + return $this->showTimestamp; + } + public function addProject($project) { $this->projects[] = $project; return $this; @@ -136,20 +146,25 @@ 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); + + if ($this->getShowTimestamp()) { + 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 = null; + $foot = pht('No time specified.'); } } else { - $foot = pht('No time specified.'); + $foot = null; } return javelin_tag(