mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-29 18:22:41 +01:00
Use phabricator_ time functions in more places
Summary: Replace some more date() calls with locale-aware calls. Also, at least on my system, the DateTimeZone / DateTime stuff didn't actually work and always rendered in UTC. Fixed that. Test Plan: Viewed daemon console, differential revisions, files, and maniphest timestamps in multiple timezones. Reviewed By: toulouse Reviewers: toulouse, fratrik, jungejason, aran, tuomaspelkonen CC: aran, toulouse Differential Revision: 530
This commit is contained in:
parent
0245b6cdf7
commit
74d57b0a42
26 changed files with 126 additions and 36 deletions
|
@ -893,7 +893,7 @@ celerity_register_resource_map(array(
|
||||||
),
|
),
|
||||||
'maniphest-task-summary-css' =>
|
'maniphest-task-summary-css' =>
|
||||||
array(
|
array(
|
||||||
'uri' => '/res/41624cb0/rsrc/css/application/maniphest/task-summary.css',
|
'uri' => '/res/0bacdd7f/rsrc/css/application/maniphest/task-summary.css',
|
||||||
'type' => 'css',
|
'type' => 'css',
|
||||||
'requires' =>
|
'requires' =>
|
||||||
array(
|
array(
|
||||||
|
@ -1057,7 +1057,7 @@ celerity_register_resource_map(array(
|
||||||
),
|
),
|
||||||
'phabricator-remarkup-css' =>
|
'phabricator-remarkup-css' =>
|
||||||
array(
|
array(
|
||||||
'uri' => '/res/d7e98209/rsrc/css/core/remarkup.css',
|
'uri' => '/res/e0c44a00/rsrc/css/core/remarkup.css',
|
||||||
'type' => 'css',
|
'type' => 'css',
|
||||||
'requires' =>
|
'requires' =>
|
||||||
array(
|
array(
|
||||||
|
@ -1132,7 +1132,7 @@ celerity_register_resource_map(array(
|
||||||
'uri' => '/res/pkg/2892314d/typeahead.pkg.js',
|
'uri' => '/res/pkg/2892314d/typeahead.pkg.js',
|
||||||
'type' => 'js',
|
'type' => 'js',
|
||||||
),
|
),
|
||||||
'd752b5da' =>
|
'cfafcff7' =>
|
||||||
array (
|
array (
|
||||||
'name' => 'core.pkg.css',
|
'name' => 'core.pkg.css',
|
||||||
'symbols' =>
|
'symbols' =>
|
||||||
|
@ -1153,7 +1153,7 @@ celerity_register_resource_map(array(
|
||||||
13 => 'phabricator-remarkup-css',
|
13 => 'phabricator-remarkup-css',
|
||||||
14 => 'syntax-highlighting-css',
|
14 => 'syntax-highlighting-css',
|
||||||
),
|
),
|
||||||
'uri' => '/res/pkg/d752b5da/core.pkg.css',
|
'uri' => '/res/pkg/cfafcff7/core.pkg.css',
|
||||||
'type' => 'css',
|
'type' => 'css',
|
||||||
),
|
),
|
||||||
'da416e1c' =>
|
'da416e1c' =>
|
||||||
|
@ -1225,15 +1225,15 @@ celerity_register_resource_map(array(
|
||||||
),
|
),
|
||||||
'reverse' =>
|
'reverse' =>
|
||||||
array (
|
array (
|
||||||
'aphront-crumbs-view-css' => 'd752b5da',
|
'aphront-crumbs-view-css' => 'cfafcff7',
|
||||||
'aphront-dialog-view-css' => 'd752b5da',
|
'aphront-dialog-view-css' => 'cfafcff7',
|
||||||
'aphront-form-view-css' => 'd752b5da',
|
'aphront-form-view-css' => 'cfafcff7',
|
||||||
'aphront-list-filter-view-css' => 'd752b5da',
|
'aphront-list-filter-view-css' => 'cfafcff7',
|
||||||
'aphront-panel-view-css' => 'd752b5da',
|
'aphront-panel-view-css' => 'cfafcff7',
|
||||||
'aphront-side-nav-view-css' => 'd752b5da',
|
'aphront-side-nav-view-css' => 'cfafcff7',
|
||||||
'aphront-table-view-css' => 'd752b5da',
|
'aphront-table-view-css' => 'cfafcff7',
|
||||||
'aphront-tokenizer-control-css' => 'd752b5da',
|
'aphront-tokenizer-control-css' => 'cfafcff7',
|
||||||
'aphront-typeahead-control-css' => 'd752b5da',
|
'aphront-typeahead-control-css' => 'cfafcff7',
|
||||||
'differential-changeset-view-css' => '55967526',
|
'differential-changeset-view-css' => '55967526',
|
||||||
'differential-core-view-css' => '55967526',
|
'differential-core-view-css' => '55967526',
|
||||||
'differential-revision-add-comment-css' => '55967526',
|
'differential-revision-add-comment-css' => '55967526',
|
||||||
|
@ -1270,13 +1270,13 @@ celerity_register_resource_map(array(
|
||||||
'javelin-util' => 'db95a6d0',
|
'javelin-util' => 'db95a6d0',
|
||||||
'javelin-vector' => 'db95a6d0',
|
'javelin-vector' => 'db95a6d0',
|
||||||
'javelin-workflow' => 'f1d27e2a',
|
'javelin-workflow' => 'f1d27e2a',
|
||||||
'phabricator-core-buttons-css' => 'd752b5da',
|
'phabricator-core-buttons-css' => 'cfafcff7',
|
||||||
'phabricator-core-css' => 'd752b5da',
|
'phabricator-core-css' => 'cfafcff7',
|
||||||
'phabricator-directory-css' => 'd752b5da',
|
'phabricator-directory-css' => 'cfafcff7',
|
||||||
'phabricator-keyboard-shortcut' => 'f1d27e2a',
|
'phabricator-keyboard-shortcut' => 'f1d27e2a',
|
||||||
'phabricator-keyboard-shortcut-manager' => 'f1d27e2a',
|
'phabricator-keyboard-shortcut-manager' => 'f1d27e2a',
|
||||||
'phabricator-remarkup-css' => 'd752b5da',
|
'phabricator-remarkup-css' => 'cfafcff7',
|
||||||
'phabricator-standard-page-view' => 'd752b5da',
|
'phabricator-standard-page-view' => 'cfafcff7',
|
||||||
'syntax-highlighting-css' => 'd752b5da',
|
'syntax-highlighting-css' => 'cfafcff7',
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
|
|
@ -37,6 +37,7 @@ class PhabricatorDaemonCombinedLogController
|
||||||
|
|
||||||
$event_view = new PhabricatorDaemonLogEventsView();
|
$event_view = new PhabricatorDaemonLogEventsView();
|
||||||
$event_view->setEvents($events);
|
$event_view->setEvents($events);
|
||||||
|
$event_view->setUser($request->getUser());
|
||||||
$event_view->setCombinedLog(true);
|
$event_view->setCombinedLog(true);
|
||||||
|
|
||||||
$log_panel = new AphrontPanelView();
|
$log_panel = new AphrontPanelView();
|
||||||
|
|
|
@ -22,7 +22,11 @@ class PhabricatorDaemonConsoleController extends PhabricatorDaemonController {
|
||||||
$logs = id(new PhabricatorDaemonLog())->loadAllWhere(
|
$logs = id(new PhabricatorDaemonLog())->loadAllWhere(
|
||||||
'1 = 1 ORDER BY id DESC LIMIT 15');
|
'1 = 1 ORDER BY id DESC LIMIT 15');
|
||||||
|
|
||||||
|
$request = $this->getRequest();
|
||||||
|
$user = $request->getUser();
|
||||||
|
|
||||||
$daemon_table = new PhabricatorDaemonLogListView();
|
$daemon_table = new PhabricatorDaemonLogListView();
|
||||||
|
$daemon_table->setUser($user);
|
||||||
$daemon_table->setDaemonLogs($logs);
|
$daemon_table->setDaemonLogs($logs);
|
||||||
|
|
||||||
$daemon_panel = new AphrontPanelView();
|
$daemon_panel = new AphrontPanelView();
|
||||||
|
|
|
@ -33,6 +33,7 @@ class PhabricatorDaemonLogListController extends PhabricatorDaemonController {
|
||||||
$pager->setURI($request->getRequestURI(), 'page');
|
$pager->setURI($request->getRequestURI(), 'page');
|
||||||
|
|
||||||
$daemon_table = new PhabricatorDaemonLogListView();
|
$daemon_table = new PhabricatorDaemonLogListView();
|
||||||
|
$daemon_table->setUser($request->getUser());
|
||||||
$daemon_table->setDaemonLogs($logs);
|
$daemon_table->setDaemonLogs($logs);
|
||||||
|
|
||||||
$daemon_panel = new AphrontPanelView();
|
$daemon_panel = new AphrontPanelView();
|
||||||
|
|
|
@ -59,7 +59,8 @@ class PhabricatorDaemonLogViewController extends PhabricatorDaemonController {
|
||||||
->appendChild(
|
->appendChild(
|
||||||
id(new AphrontFormStaticControl())
|
id(new AphrontFormStaticControl())
|
||||||
->setLabel('Started')
|
->setLabel('Started')
|
||||||
->setValue(date('F jS, Y g:i:s A', $log->getDateCreated())))
|
->setValue(
|
||||||
|
phabricator_datetime($log->getDateCreated(), $user)))
|
||||||
->appendChild(
|
->appendChild(
|
||||||
id(new AphrontFormTextAreaControl())
|
id(new AphrontFormTextAreaControl())
|
||||||
->setLabel('Argv')
|
->setLabel('Argv')
|
||||||
|
@ -73,6 +74,7 @@ class PhabricatorDaemonLogViewController extends PhabricatorDaemonController {
|
||||||
$content[] = $panel;
|
$content[] = $panel;
|
||||||
|
|
||||||
$event_view = new PhabricatorDaemonLogEventsView();
|
$event_view = new PhabricatorDaemonLogEventsView();
|
||||||
|
$event_view->setUser($user);
|
||||||
$event_view->setEvents($events);
|
$event_view->setEvents($events);
|
||||||
|
|
||||||
$log_panel = new AphrontPanelView();
|
$log_panel = new AphrontPanelView();
|
||||||
|
|
|
@ -15,6 +15,7 @@ phutil_require_module('phabricator', 'view/form/base');
|
||||||
phutil_require_module('phabricator', 'view/form/control/static');
|
phutil_require_module('phabricator', 'view/form/control/static');
|
||||||
phutil_require_module('phabricator', 'view/form/control/textarea');
|
phutil_require_module('phabricator', 'view/form/control/textarea');
|
||||||
phutil_require_module('phabricator', 'view/layout/panel');
|
phutil_require_module('phabricator', 'view/layout/panel');
|
||||||
|
phutil_require_module('phabricator', 'view/utils');
|
||||||
|
|
||||||
phutil_require_module('phutil', 'utils');
|
phutil_require_module('phutil', 'utils');
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ final class PhabricatorDaemonLogEventsView extends AphrontView {
|
||||||
|
|
||||||
private $events;
|
private $events;
|
||||||
private $combinedLog;
|
private $combinedLog;
|
||||||
|
private $user;
|
||||||
|
|
||||||
public function setEvents(array $events) {
|
public function setEvents(array $events) {
|
||||||
$this->events = $events;
|
$this->events = $events;
|
||||||
|
@ -29,14 +30,23 @@ final class PhabricatorDaemonLogEventsView extends AphrontView {
|
||||||
$this->combinedLog = $is_combined;
|
$this->combinedLog = $is_combined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setUser(PhabricatorUser $user) {
|
||||||
|
$this->user = $user;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function render() {
|
public function render() {
|
||||||
$rows = array();
|
$rows = array();
|
||||||
|
|
||||||
|
if (!$this->user) {
|
||||||
|
throw new Exception("Call setUser() before rendering!");
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($this->events as $event) {
|
foreach ($this->events as $event) {
|
||||||
$row = array(
|
$row = array(
|
||||||
phutil_escape_html($event->getLogType()),
|
phutil_escape_html($event->getLogType()),
|
||||||
date('M j, Y', $event->getEpoch()),
|
phabricator_date($event->getEpoch(), $this->user),
|
||||||
date('g:i:s A', $event->getEpoch()),
|
phabricator_time($event->getEpoch(), $this->user),
|
||||||
str_replace("\n", '<br />', phutil_escape_html($event->getMessage())),
|
str_replace("\n", '<br />', phutil_escape_html($event->getMessage())),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
phutil_require_module('phabricator', 'view/base');
|
phutil_require_module('phabricator', 'view/base');
|
||||||
phutil_require_module('phabricator', 'view/control/table');
|
phutil_require_module('phabricator', 'view/control/table');
|
||||||
|
phutil_require_module('phabricator', 'view/utils');
|
||||||
|
|
||||||
phutil_require_module('phutil', 'markup');
|
phutil_require_module('phutil', 'markup');
|
||||||
|
|
||||||
|
|
|
@ -19,14 +19,24 @@
|
||||||
final class PhabricatorDaemonLogListView extends AphrontView {
|
final class PhabricatorDaemonLogListView extends AphrontView {
|
||||||
|
|
||||||
private $daemonLogs;
|
private $daemonLogs;
|
||||||
|
private $user;
|
||||||
|
|
||||||
public function setDaemonLogs(array $daemon_logs) {
|
public function setDaemonLogs(array $daemon_logs) {
|
||||||
$this->daemonLogs = $daemon_logs;
|
$this->daemonLogs = $daemon_logs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setUser(PhabricatorUser $user) {
|
||||||
|
$this->user = $user;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function render() {
|
public function render() {
|
||||||
$rows = array();
|
$rows = array();
|
||||||
|
|
||||||
|
if (!$this->user) {
|
||||||
|
throw new Exception("Call setUser() before rendering!");
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($this->daemonLogs as $log) {
|
foreach ($this->daemonLogs as $log) {
|
||||||
$epoch = $log->getDateCreated();
|
$epoch = $log->getDateCreated();
|
||||||
|
|
||||||
|
@ -73,8 +83,8 @@ final class PhabricatorDaemonLogListView extends AphrontView {
|
||||||
phutil_escape_html($log->getDaemon()),
|
phutil_escape_html($log->getDaemon()),
|
||||||
phutil_escape_html($log->getHost()),
|
phutil_escape_html($log->getHost()),
|
||||||
$log->getPID(),
|
$log->getPID(),
|
||||||
date('M j, Y', $epoch),
|
phabricator_date($epoch, $this->user),
|
||||||
date('g:i A', $epoch),
|
phabricator_time($epoch, $this->user),
|
||||||
phutil_render_tag(
|
phutil_render_tag(
|
||||||
'a',
|
'a',
|
||||||
array(
|
array(
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
phutil_require_module('phabricator', 'view/base');
|
phutil_require_module('phabricator', 'view/base');
|
||||||
phutil_require_module('phabricator', 'view/control/table');
|
phutil_require_module('phabricator', 'view/control/table');
|
||||||
|
phutil_require_module('phabricator', 'view/utils');
|
||||||
|
|
||||||
phutil_require_module('phutil', 'markup');
|
phutil_require_module('phutil', 'markup');
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ class DifferentialCommentPreviewController extends DifferentialController {
|
||||||
$comment->setAuthorPHID($author_phid);
|
$comment->setAuthorPHID($author_phid);
|
||||||
|
|
||||||
$view = new DifferentialRevisionCommentView();
|
$view = new DifferentialRevisionCommentView();
|
||||||
|
$view->setUser($request->getUser());
|
||||||
$view->setComment($comment);
|
$view->setComment($comment);
|
||||||
$view->setHandles($handles);
|
$view->setHandles($handles);
|
||||||
$view->setMarkupEngine($engine);
|
$view->setMarkupEngine($engine);
|
||||||
|
|
|
@ -26,6 +26,7 @@ final class DifferentialRevisionCommentView extends AphrontView {
|
||||||
private $changesets;
|
private $changesets;
|
||||||
private $target;
|
private $target;
|
||||||
private $commentNumber;
|
private $commentNumber;
|
||||||
|
private $user;
|
||||||
|
|
||||||
public function setComment($comment) {
|
public function setComment($comment) {
|
||||||
$this->comment = $comment;
|
$this->comment = $comment;
|
||||||
|
@ -67,8 +68,17 @@ final class DifferentialRevisionCommentView extends AphrontView {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setUser(PhabricatorUser $user) {
|
||||||
|
$this->user = $user;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function render() {
|
public function render() {
|
||||||
|
|
||||||
|
if (!$this->user) {
|
||||||
|
throw new Exception("Call setUser() before rendering!");
|
||||||
|
}
|
||||||
|
|
||||||
require_celerity_resource('phabricator-remarkup-css');
|
require_celerity_resource('phabricator-remarkup-css');
|
||||||
require_celerity_resource('differential-revision-comment-css');
|
require_celerity_resource('differential-revision-comment-css');
|
||||||
|
|
||||||
|
@ -81,7 +91,7 @@ final class DifferentialRevisionCommentView extends AphrontView {
|
||||||
if ($this->preview) {
|
if ($this->preview) {
|
||||||
$date = 'COMMENT PREVIEW';
|
$date = 'COMMENT PREVIEW';
|
||||||
} else {
|
} else {
|
||||||
$date = date('F jS, Y g:i:s A', $comment->getDateCreated());
|
$date = phabricator_datetime($comment->getDateCreated(), $this->user);
|
||||||
}
|
}
|
||||||
|
|
||||||
$info = array($date);
|
$info = array($date);
|
||||||
|
|
|
@ -11,6 +11,7 @@ phutil_require_module('phabricator', 'applications/differential/storage/comment'
|
||||||
phutil_require_module('phabricator', 'infrastructure/celerity/api');
|
phutil_require_module('phabricator', 'infrastructure/celerity/api');
|
||||||
phutil_require_module('phabricator', 'infrastructure/javelin/api');
|
phutil_require_module('phabricator', 'infrastructure/javelin/api');
|
||||||
phutil_require_module('phabricator', 'view/base');
|
phutil_require_module('phabricator', 'view/base');
|
||||||
|
phutil_require_module('phabricator', 'view/utils');
|
||||||
|
|
||||||
phutil_require_module('phutil', 'markup');
|
phutil_require_module('phutil', 'markup');
|
||||||
phutil_require_module('phutil', 'utils');
|
phutil_require_module('phutil', 'utils');
|
||||||
|
|
|
@ -68,6 +68,7 @@ final class DifferentialRevisionCommentListView extends AphrontView {
|
||||||
foreach ($this->comments as $comment) {
|
foreach ($this->comments as $comment) {
|
||||||
$view = new DifferentialRevisionCommentView();
|
$view = new DifferentialRevisionCommentView();
|
||||||
$view->setComment($comment);
|
$view->setComment($comment);
|
||||||
|
$view->setUser($this->user);
|
||||||
$view->setHandles($this->handles);
|
$view->setHandles($this->handles);
|
||||||
$view->setMarkupEngine($engine);
|
$view->setMarkupEngine($engine);
|
||||||
$view->setInlineComments(idx($inlines, $comment->getID(), array()));
|
$view->setInlineComments(idx($inlines, $comment->getID(), array()));
|
||||||
|
|
|
@ -28,6 +28,9 @@ class PhabricatorFileViewController extends PhabricatorFileController {
|
||||||
|
|
||||||
public function processRequest() {
|
public function processRequest() {
|
||||||
|
|
||||||
|
$request = $this->getRequest();
|
||||||
|
$user = $request->getUser();
|
||||||
|
|
||||||
$file = id(new PhabricatorFile())->loadOneWhere(
|
$file = id(new PhabricatorFile())->loadOneWhere(
|
||||||
'phid = %s',
|
'phid = %s',
|
||||||
$this->phid);
|
$this->phid);
|
||||||
|
@ -93,7 +96,7 @@ class PhabricatorFileViewController extends PhabricatorFileController {
|
||||||
id(new AphrontFormStaticControl())
|
id(new AphrontFormStaticControl())
|
||||||
->setLabel('Created')
|
->setLabel('Created')
|
||||||
->setName('created')
|
->setName('created')
|
||||||
->setValue(date('Y-m-d g:i:s A', $file->getDateCreated())))
|
->setValue(phabricator_datetime($file->getDateCreated(), $user)))
|
||||||
->appendChild(
|
->appendChild(
|
||||||
id(new AphrontFormStaticControl())
|
id(new AphrontFormStaticControl())
|
||||||
->setLabel('Mime Type')
|
->setLabel('Mime Type')
|
||||||
|
|
|
@ -18,6 +18,7 @@ phutil_require_module('phabricator', 'view/form/base');
|
||||||
phutil_require_module('phabricator', 'view/form/control/static');
|
phutil_require_module('phabricator', 'view/form/control/static');
|
||||||
phutil_require_module('phabricator', 'view/form/control/submit');
|
phutil_require_module('phabricator', 'view/form/control/submit');
|
||||||
phutil_require_module('phabricator', 'view/layout/panel');
|
phutil_require_module('phabricator', 'view/layout/panel');
|
||||||
|
phutil_require_module('phabricator', 'view/utils');
|
||||||
|
|
||||||
phutil_require_module('phutil', 'markup');
|
phutil_require_module('phutil', 'markup');
|
||||||
phutil_require_module('phutil', 'utils');
|
phutil_require_module('phutil', 'utils');
|
||||||
|
|
|
@ -50,6 +50,7 @@ class ManiphestTaskDescriptionChangeController extends ManiphestController {
|
||||||
$view = new ManiphestTransactionDetailView();
|
$view = new ManiphestTransactionDetailView();
|
||||||
$view->setTransactionGroup($transactions);
|
$view->setTransactionGroup($transactions);
|
||||||
$view->setHandles($handles);
|
$view->setHandles($handles);
|
||||||
|
$view->setUser($user);
|
||||||
$view->setMarkupEngine($engine);
|
$view->setMarkupEngine($engine);
|
||||||
$view->setRenderSummaryOnly(true);
|
$view->setRenderSummaryOnly(true);
|
||||||
$view->setRenderFullSummary(true);
|
$view->setRenderFullSummary(true);
|
||||||
|
|
|
@ -160,6 +160,7 @@ class ManiphestTaskListController extends ManiphestController {
|
||||||
} else {
|
} else {
|
||||||
foreach ($tasks as $group => $list) {
|
foreach ($tasks as $group => $list) {
|
||||||
$task_list = new ManiphestTaskListView();
|
$task_list = new ManiphestTaskListView();
|
||||||
|
$task_list->setUser($user);
|
||||||
$task_list->setTasks($list);
|
$task_list->setTasks($list);
|
||||||
$task_list->setHandles($handles);
|
$task_list->setHandles($handles);
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ class ManiphestTaskListView extends AphrontView {
|
||||||
|
|
||||||
private $tasks;
|
private $tasks;
|
||||||
private $handles;
|
private $handles;
|
||||||
|
private $user;
|
||||||
|
|
||||||
public function setTasks(array $tasks) {
|
public function setTasks(array $tasks) {
|
||||||
$this->tasks = $tasks;
|
$this->tasks = $tasks;
|
||||||
|
@ -31,12 +32,18 @@ class ManiphestTaskListView extends AphrontView {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setUser(PhabricatorUser $user) {
|
||||||
|
$this->user = $user;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function render() {
|
public function render() {
|
||||||
|
|
||||||
$views = array();
|
$views = array();
|
||||||
foreach ($this->tasks as $task) {
|
foreach ($this->tasks as $task) {
|
||||||
$view = new ManiphestTaskSummaryView();
|
$view = new ManiphestTaskSummaryView();
|
||||||
$view->setTask($task);
|
$view->setTask($task);
|
||||||
|
$view->setUser($this->user);
|
||||||
$view->setHandles($this->handles);
|
$view->setHandles($this->handles);
|
||||||
$views[] = $view->render();
|
$views[] = $view->render();
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ class ManiphestTaskSummaryView extends AphrontView {
|
||||||
|
|
||||||
private $task;
|
private $task;
|
||||||
private $handles;
|
private $handles;
|
||||||
|
private $user;
|
||||||
|
|
||||||
public function setTask(ManiphestTask $task) {
|
public function setTask(ManiphestTask $task) {
|
||||||
$this->task = $task;
|
$this->task = $task;
|
||||||
|
@ -31,7 +32,17 @@ class ManiphestTaskSummaryView extends AphrontView {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setUser(PhabricatorUser $user) {
|
||||||
|
$this->user = $user;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function render() {
|
public function render() {
|
||||||
|
|
||||||
|
if (!$this->user) {
|
||||||
|
throw new Exception("Call setUser() before rendering!");
|
||||||
|
}
|
||||||
|
|
||||||
$task = $this->task;
|
$task = $this->task;
|
||||||
$handles = $this->handles;
|
$handles = $this->handles;
|
||||||
|
|
||||||
|
@ -76,7 +87,7 @@ class ManiphestTaskSummaryView extends AphrontView {
|
||||||
ManiphestTaskPriority::getTaskPriorityName($task->getPriority()).
|
ManiphestTaskPriority::getTaskPriorityName($task->getPriority()).
|
||||||
'</td>'.
|
'</td>'.
|
||||||
'<td class="maniphest-task-updated">'.
|
'<td class="maniphest-task-updated">'.
|
||||||
phabricator_format_timestamp($task->getDateModified()).
|
phabricator_datetime($task->getDateModified(), $this->user).
|
||||||
'</td>'.
|
'</td>'.
|
||||||
'</tr>'.
|
'</tr>'.
|
||||||
'</table>';
|
'</table>';
|
||||||
|
|
|
@ -27,6 +27,7 @@ class ManiphestTransactionDetailView extends AphrontView {
|
||||||
|
|
||||||
private $renderSummaryOnly;
|
private $renderSummaryOnly;
|
||||||
private $renderFullSummary;
|
private $renderFullSummary;
|
||||||
|
private $user;
|
||||||
|
|
||||||
public function setTransactionGroup(array $transactions) {
|
public function setTransactionGroup(array $transactions) {
|
||||||
$this->transactions = $transactions;
|
$this->transactions = $transactions;
|
||||||
|
@ -71,6 +72,11 @@ class ManiphestTransactionDetailView extends AphrontView {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setUser(PhabricatorUser $user) {
|
||||||
|
$this->user = $user;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function renderForEmail($with_date) {
|
public function renderForEmail($with_date) {
|
||||||
$this->forEmail = true;
|
$this->forEmail = true;
|
||||||
|
|
||||||
|
@ -87,8 +93,11 @@ class ManiphestTransactionDetailView extends AphrontView {
|
||||||
}
|
}
|
||||||
$desc = $author.' '.$desc.'.';
|
$desc = $author.' '.$desc.'.';
|
||||||
if ($with_date) {
|
if ($with_date) {
|
||||||
$desc = 'On '.date('M jS \a\t g:i A', $transaction->getDateCreated()).
|
// NOTE: This is going into a (potentially multi-recipient) email so
|
||||||
', '.$desc;
|
// we can't use a single user's timezone preferences. Use the server's
|
||||||
|
// instead, but make the timezone explicit.
|
||||||
|
$datetime = date('M jS \a\t g:i A T', $transaction->getDateCreated());
|
||||||
|
$desc = "On {$datetime}, {$desc}";
|
||||||
}
|
}
|
||||||
$descs[] = $desc;
|
$descs[] = $desc;
|
||||||
if ($transaction->hasComments()) {
|
if ($transaction->hasComments()) {
|
||||||
|
@ -114,6 +123,11 @@ class ManiphestTransactionDetailView extends AphrontView {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render() {
|
public function render() {
|
||||||
|
|
||||||
|
if (!$this->user) {
|
||||||
|
throw new Exception("Call setUser() before render()!");
|
||||||
|
}
|
||||||
|
|
||||||
$handles = $this->handles;
|
$handles = $this->handles;
|
||||||
$transactions = $this->transactions;
|
$transactions = $this->transactions;
|
||||||
|
|
||||||
|
@ -177,7 +191,9 @@ class ManiphestTransactionDetailView extends AphrontView {
|
||||||
if ($this->preview) {
|
if ($this->preview) {
|
||||||
$timestamp = 'COMMENT PREVIEW';
|
$timestamp = 'COMMENT PREVIEW';
|
||||||
} else {
|
} else {
|
||||||
$timestamp = phabricator_format_timestamp($transaction->getDateCreated());
|
$timestamp = phabricator_datetime(
|
||||||
|
$transaction->getDateCreated(),
|
||||||
|
$this->user);
|
||||||
}
|
}
|
||||||
|
|
||||||
$info = array();
|
$info = array();
|
||||||
|
|
|
@ -80,6 +80,7 @@ class ManiphestTransactionListView extends AphrontView {
|
||||||
$sequence = 1;
|
$sequence = 1;
|
||||||
foreach ($groups as $group) {
|
foreach ($groups as $group) {
|
||||||
$view = new ManiphestTransactionDetailView();
|
$view = new ManiphestTransactionDetailView();
|
||||||
|
$view->setUser($this->user);
|
||||||
$view->setTransactionGroup($group);
|
$view->setTransactionGroup($group);
|
||||||
$view->setHandles($this->handles);
|
$view->setHandles($this->handles);
|
||||||
$view->setMarkupEngine($this->markupEngine);
|
$view->setMarkupEngine($this->markupEngine);
|
||||||
|
|
|
@ -21,6 +21,7 @@ class PhabricatorMetaMTAListController extends PhabricatorMetaMTAController {
|
||||||
public function processRequest() {
|
public function processRequest() {
|
||||||
// Get a page of mails together with pager.
|
// Get a page of mails together with pager.
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
|
$user = $request->getUser();
|
||||||
$offset = $request->getInt('offset', 0);
|
$offset = $request->getInt('offset', 0);
|
||||||
$related_phid = $request->getStr('phid');
|
$related_phid = $request->getStr('phid');
|
||||||
|
|
||||||
|
@ -60,7 +61,7 @@ class PhabricatorMetaMTAListController extends PhabricatorMetaMTAController {
|
||||||
PhabricatorMetaMTAMail::getReadableStatus($mail->getStatus()),
|
PhabricatorMetaMTAMail::getReadableStatus($mail->getStatus()),
|
||||||
$mail->getRetryCount(),
|
$mail->getRetryCount(),
|
||||||
($mail->getNextRetry() - time()).' s',
|
($mail->getNextRetry() - time()).' s',
|
||||||
date('Y-m-d g:i:s A', $mail->getDateCreated()),
|
phabricator_datetime($mail->getDateCreated(), $user),
|
||||||
(time() - $mail->getDateModified()).' s',
|
(time() - $mail->getDateModified()).' s',
|
||||||
phutil_escape_html($mail->getSubject()),
|
phutil_escape_html($mail->getSubject()),
|
||||||
phutil_render_tag(
|
phutil_render_tag(
|
||||||
|
|
|
@ -13,6 +13,7 @@ phutil_require_module('phabricator', 'storage/queryfx');
|
||||||
phutil_require_module('phabricator', 'view/control/pager');
|
phutil_require_module('phabricator', 'view/control/pager');
|
||||||
phutil_require_module('phabricator', 'view/control/table');
|
phutil_require_module('phabricator', 'view/control/table');
|
||||||
phutil_require_module('phabricator', 'view/layout/panel');
|
phutil_require_module('phabricator', 'view/layout/panel');
|
||||||
|
phutil_require_module('phabricator', 'view/utils');
|
||||||
|
|
||||||
phutil_require_module('phutil', 'markup');
|
phutil_require_module('phutil', 'markup');
|
||||||
|
|
||||||
|
|
|
@ -18,19 +18,22 @@
|
||||||
|
|
||||||
function phabricator_date($epoch, $user) {
|
function phabricator_date($epoch, $user) {
|
||||||
$zone = new DateTimeZone($user->getTimezoneIdentifier());
|
$zone = new DateTimeZone($user->getTimezoneIdentifier());
|
||||||
$date = new DateTime('@'.$epoch, $zone);
|
$date = new DateTime('@'.$epoch);
|
||||||
|
$date->setTimeZone($zone);
|
||||||
return $date->format('M j Y');
|
return $date->format('M j Y');
|
||||||
}
|
}
|
||||||
|
|
||||||
function phabricator_time($epoch, $user) {
|
function phabricator_time($epoch, $user) {
|
||||||
$zone = new DateTimeZone($user->getTimezoneIdentifier());
|
$zone = new DateTimeZone($user->getTimezoneIdentifier());
|
||||||
$date = new DateTime('@'.$epoch, $zone);
|
$date = new DateTime('@'.$epoch);
|
||||||
|
$date->setTimeZone($zone);
|
||||||
return $date->format('g:i A');
|
return $date->format('g:i A');
|
||||||
}
|
}
|
||||||
|
|
||||||
function phabricator_datetime($epoch, $user) {
|
function phabricator_datetime($epoch, $user) {
|
||||||
$zone = new DateTimeZone($user->getTimezoneIdentifier());
|
$zone = new DateTimeZone($user->getTimezoneIdentifier());
|
||||||
$date = new DateTime('@'.$epoch, $zone);
|
$date = new DateTime('@'.$epoch);
|
||||||
|
$date->setTimeZone($zone);
|
||||||
return $date->format('M j Y, g:i A');
|
return $date->format('M j Y, g:i A');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,8 +49,8 @@
|
||||||
|
|
||||||
.maniphest-task-summary td.maniphest-task-updated {
|
.maniphest-task-summary td.maniphest-task-updated {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
width: 11%;
|
width: 13%;
|
||||||
min-width: 120px;
|
min-width: 160px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.maniphest-task-summary .pri-bullet {
|
.maniphest-task-summary .pri-bullet {
|
||||||
|
|
Loading…
Reference in a new issue