1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-18 18:51:12 +01:00

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
This commit is contained in:
epriestley 2016-07-08 07:38:37 -07:00
parent 5c8dabdf80
commit bd6d300282
3 changed files with 41 additions and 12 deletions

View file

@ -5,6 +5,7 @@ final class PhabricatorNotificationBuilder extends Phobject {
private $stories; private $stories;
private $parsedStories; private $parsedStories;
private $user = null; private $user = null;
private $showTimestamps = true;
public function __construct(array $stories) { public function __construct(array $stories) {
assert_instances_of($stories, 'PhabricatorFeedStory'); assert_instances_of($stories, 'PhabricatorFeedStory');
@ -16,6 +17,15 @@ final class PhabricatorNotificationBuilder extends Phobject {
return $this; return $this;
} }
public function setShowTimestamps($show_timestamps) {
$this->showTimestamps = $show_timestamps;
return $this;
}
public function getShowTimestamps() {
return $this->showTimestamps;
}
private function parseStories() { private function parseStories() {
if ($this->parsedStories) { if ($this->parsedStories) {
@ -121,6 +131,9 @@ final class PhabricatorNotificationBuilder extends Phobject {
// TODO: Render a nice debuggable notice instead? // TODO: Render a nice debuggable notice instead?
continue; continue;
} }
$view->setShowTimestamp($this->getShowTimestamps());
$null_view->appendChild($view->renderNotification($this->user)); $null_view->appendChild($view->renderNotification($this->user));
} }

View file

@ -31,7 +31,8 @@ final class PhabricatorNotificationIndividualController
} }
$builder = id(new PhabricatorNotificationBuilder(array($story))) $builder = id(new PhabricatorNotificationBuilder(array($story)))
->setUser($viewer); ->setUser($viewer)
->setShowTimestamps(false);
$content = $builder->buildView()->render(); $content = $builder->buildView()->render();
$dict = $builder->buildDict(); $dict = $builder->buildDict();

View file

@ -17,6 +17,7 @@ final class PHUIFeedStoryView extends AphrontView {
private $chronologicalKey; private $chronologicalKey;
private $tags; private $tags;
private $authorIcon; private $authorIcon;
private $showTimestamp = true;
public function setTags($tags) { public function setTags($tags) {
$this->tags = $tags; $this->tags = $tags;
@ -97,6 +98,15 @@ final class PHUIFeedStoryView extends AphrontView {
return $this; return $this;
} }
public function setShowTimestamp($show_timestamp) {
$this->showTimestamp = $show_timestamp;
return $this;
}
public function getShowTimestamp() {
return $this->showTimestamp;
}
public function addProject($project) { public function addProject($project) {
$this->projects[] = $project; $this->projects[] = $project;
return $this; return $this;
@ -136,20 +146,25 @@ final class PHUIFeedStoryView extends AphrontView {
if (!$this->viewed) { if (!$this->viewed) {
$classes[] = 'phabricator-notification-unread'; $classes[] = 'phabricator-notification-unread';
} }
if ($this->epoch) {
if ($user) { if ($this->getShowTimestamp()) {
$foot = phabricator_datetime($this->epoch, $user); if ($this->epoch) {
$foot = phutil_tag( if ($user) {
'span', $foot = phabricator_datetime($this->epoch, $user);
array( $foot = phutil_tag(
'class' => 'phabricator-notification-date', 'span',
), array(
$foot); 'class' => 'phabricator-notification-date',
),
$foot);
} else {
$foot = null;
}
} else { } else {
$foot = null; $foot = pht('No time specified.');
} }
} else { } else {
$foot = pht('No time specified.'); $foot = null;
} }
return javelin_tag( return javelin_tag(