Skip to content

Commit 57f1a83

Browse files
committedJan 23, 2014
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
1 parent 36892cf commit 57f1a83

File tree

5 files changed

+32
-7
lines changed

5 files changed

+32
-7
lines changed
 

‎resources/celerity/map.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
return array(
88
'names' =>
99
array(
10-
'core.pkg.css' => '2eafddad',
10+
'core.pkg.css' => '6c70dd0e',
1111
'core.pkg.js' => 'c907bd96',
1212
'darkconsole.pkg.js' => 'ca8671ce',
1313
'differential.pkg.css' => '5a65a762',
@@ -40,7 +40,7 @@
4040
'rsrc/css/aphront/typeahead.css' => '00c9a200',
4141
'rsrc/css/application/auth/auth.css' => '1e655982',
4242
'rsrc/css/application/base/main-menu-view.css' => 'aba0b7a6',
43-
'rsrc/css/application/base/notification-menu.css' => '07433791',
43+
'rsrc/css/application/base/notification-menu.css' => 'fc9a363c',
4444
'rsrc/css/application/base/phabricator-application-launch-view.css' => '6f8453d9',
4545
'rsrc/css/application/base/standard-page-view.css' => '517cdfb1',
4646
'rsrc/css/application/chatlog/chatlog.css' => '0cd2bc78',
@@ -693,7 +693,7 @@
693693
'phabricator-nav-view-css' => 'd0d4a509',
694694
'phabricator-notification' => '95944043',
695695
'phabricator-notification-css' => '6901121e',
696-
'phabricator-notification-menu-css' => '07433791',
696+
'phabricator-notification-menu-css' => 'fc9a363c',
697697
'phabricator-object-list-view-css' => '1a1ea560',
698698
'phabricator-object-selector-css' => '029a133d',
699699
'phabricator-phtize' => 'd254d646',

‎src/applications/notification/builder/PhabricatorNotificationBuilder.php

+7-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,17 @@
33
final class PhabricatorNotificationBuilder {
44

55
private $stories;
6+
private $user = null;
67

78
public function __construct(array $stories) {
89
$this->stories = $stories;
910
}
1011

12+
public function setUser($user) {
13+
$this->user = $user;
14+
return $this;
15+
}
16+
1117
public function buildView() {
1218

1319
$stories = $this->stories;
@@ -124,8 +130,7 @@ public function buildView() {
124130

125131
foreach ($stories as $story) {
126132
$view = $story->renderView();
127-
128-
$null_view->appendChild($view->renderNotification());
133+
$null_view->appendChild($view->renderNotification($this->user));
129134
}
130135

131136
return $null_view;

‎src/applications/notification/controller/PhabricatorNotificationListController.php

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public function processRequest() {
4343

4444
if ($notifications) {
4545
$builder = new PhabricatorNotificationBuilder($notifications);
46+
$builder->setUser($user);
4647
$view = $builder->buildView()->render();
4748
} else {
4849
$view = phutil_tag_div(

‎src/view/phui/PHUIFeedStoryView.php

+16-2
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,28 @@ public function getHref() {
9999
return $this->href;
100100
}
101101

102-
public function renderNotification() {
102+
public function renderNotification($user) {
103103
$classes = array(
104104
'phabricator-notification',
105105
);
106106

107107
if (!$this->viewed) {
108108
$classes[] = 'phabricator-notification-unread';
109109
}
110+
if ($this->epoch) {
111+
if ($user) {
112+
$foot = phabricator_datetime($this->epoch, $user);
113+
$foot = phutil_tag(
114+
'span',
115+
array(
116+
'class' => 'phabricator-notification-date'),
117+
$foot);
118+
} else {
119+
$foot = null;
120+
}
121+
} else {
122+
$foot = pht('No time specified.');
123+
}
110124

111125
return javelin_tag(
112126
'div',
@@ -117,7 +131,7 @@ public function renderNotification() {
117131
'href' => $this->getHref(),
118132
),
119133
),
120-
$this->title);
134+
array($this->title, $foot));
121135
}
122136

123137
public function render() {

‎webroot/rsrc/css/application/base/notification-menu.css

+5
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
border-radius: 3px;
1414
}
1515

16+
.phabricator-notification .phabricator-notification-date {
17+
margin-left: 8px;
18+
color: {$lightgreytext};
19+
}
20+
1621
.phabricator-notification-menu-loading {
1722
text-align: center;
1823
padding: 10px 0;

0 commit comments

Comments
 (0)
Failed to load comments.