From 74d57b0a428ce91d605e3553442e3ce59f04b15e Mon Sep 17 00:00:00 2001 From: epriestley Date: Sun, 26 Jun 2011 09:22:52 -0700 Subject: [PATCH] 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 --- src/__celerity_resource_map__.php | 38 +++++++++---------- ...PhabricatorDaemonCombinedLogController.php | 1 + .../PhabricatorDaemonConsoleController.php | 4 ++ .../PhabricatorDaemonLogListController.php | 1 + .../PhabricatorDaemonLogViewController.php | 4 +- .../daemon/controller/logview/__init__.php | 1 + .../PhabricatorDaemonLogEventsView.php | 14 ++++++- .../daemon/view/daemonlogevents/__init__.php | 1 + .../PhabricatorDaemonLogListView.php | 14 ++++++- .../daemon/view/daemonloglist/__init__.php | 1 + .../DifferentialCommentPreviewController.php | 1 + .../DifferentialRevisionCommentView.php | 12 +++++- .../view/revisioncomment/__init__.php | 1 + .../DifferentialRevisionCommentListView.php | 1 + .../view/PhabricatorFileViewController.php | 5 ++- .../files/controller/view/__init__.php | 1 + ...niphestTaskDescriptionChangeController.php | 1 + .../tasklist/ManiphestTaskListController.php | 1 + .../view/tasklist/ManiphestTaskListView.php | 7 ++++ .../tasksummary/ManiphestTaskSummaryView.php | 13 ++++++- .../ManiphestTransactionDetailView.php | 22 +++++++++-- .../ManiphestTransactionListView.php | 1 + .../list/PhabricatorMetaMTAListController.php | 3 +- .../metamta/controller/list/__init__.php | 1 + src/view/utils/viewutils.php | 9 +++-- .../application/maniphest/task-summary.css | 4 +- 26 files changed, 126 insertions(+), 36 deletions(-) diff --git a/src/__celerity_resource_map__.php b/src/__celerity_resource_map__.php index 2c299dd4c8..3903571d0d 100644 --- a/src/__celerity_resource_map__.php +++ b/src/__celerity_resource_map__.php @@ -893,7 +893,7 @@ celerity_register_resource_map(array( ), 'maniphest-task-summary-css' => array( - 'uri' => '/res/41624cb0/rsrc/css/application/maniphest/task-summary.css', + 'uri' => '/res/0bacdd7f/rsrc/css/application/maniphest/task-summary.css', 'type' => 'css', 'requires' => array( @@ -1057,7 +1057,7 @@ celerity_register_resource_map(array( ), 'phabricator-remarkup-css' => array( - 'uri' => '/res/d7e98209/rsrc/css/core/remarkup.css', + 'uri' => '/res/e0c44a00/rsrc/css/core/remarkup.css', 'type' => 'css', 'requires' => array( @@ -1132,7 +1132,7 @@ celerity_register_resource_map(array( 'uri' => '/res/pkg/2892314d/typeahead.pkg.js', 'type' => 'js', ), - 'd752b5da' => + 'cfafcff7' => array ( 'name' => 'core.pkg.css', 'symbols' => @@ -1153,7 +1153,7 @@ celerity_register_resource_map(array( 13 => 'phabricator-remarkup-css', 14 => 'syntax-highlighting-css', ), - 'uri' => '/res/pkg/d752b5da/core.pkg.css', + 'uri' => '/res/pkg/cfafcff7/core.pkg.css', 'type' => 'css', ), 'da416e1c' => @@ -1225,15 +1225,15 @@ celerity_register_resource_map(array( ), 'reverse' => array ( - 'aphront-crumbs-view-css' => 'd752b5da', - 'aphront-dialog-view-css' => 'd752b5da', - 'aphront-form-view-css' => 'd752b5da', - 'aphront-list-filter-view-css' => 'd752b5da', - 'aphront-panel-view-css' => 'd752b5da', - 'aphront-side-nav-view-css' => 'd752b5da', - 'aphront-table-view-css' => 'd752b5da', - 'aphront-tokenizer-control-css' => 'd752b5da', - 'aphront-typeahead-control-css' => 'd752b5da', + 'aphront-crumbs-view-css' => 'cfafcff7', + 'aphront-dialog-view-css' => 'cfafcff7', + 'aphront-form-view-css' => 'cfafcff7', + 'aphront-list-filter-view-css' => 'cfafcff7', + 'aphront-panel-view-css' => 'cfafcff7', + 'aphront-side-nav-view-css' => 'cfafcff7', + 'aphront-table-view-css' => 'cfafcff7', + 'aphront-tokenizer-control-css' => 'cfafcff7', + 'aphront-typeahead-control-css' => 'cfafcff7', 'differential-changeset-view-css' => '55967526', 'differential-core-view-css' => '55967526', 'differential-revision-add-comment-css' => '55967526', @@ -1270,13 +1270,13 @@ celerity_register_resource_map(array( 'javelin-util' => 'db95a6d0', 'javelin-vector' => 'db95a6d0', 'javelin-workflow' => 'f1d27e2a', - 'phabricator-core-buttons-css' => 'd752b5da', - 'phabricator-core-css' => 'd752b5da', - 'phabricator-directory-css' => 'd752b5da', + 'phabricator-core-buttons-css' => 'cfafcff7', + 'phabricator-core-css' => 'cfafcff7', + 'phabricator-directory-css' => 'cfafcff7', 'phabricator-keyboard-shortcut' => 'f1d27e2a', 'phabricator-keyboard-shortcut-manager' => 'f1d27e2a', - 'phabricator-remarkup-css' => 'd752b5da', - 'phabricator-standard-page-view' => 'd752b5da', - 'syntax-highlighting-css' => 'd752b5da', + 'phabricator-remarkup-css' => 'cfafcff7', + 'phabricator-standard-page-view' => 'cfafcff7', + 'syntax-highlighting-css' => 'cfafcff7', ), )); diff --git a/src/applications/daemon/controller/combined/PhabricatorDaemonCombinedLogController.php b/src/applications/daemon/controller/combined/PhabricatorDaemonCombinedLogController.php index 1b237b23da..6d0409ac25 100644 --- a/src/applications/daemon/controller/combined/PhabricatorDaemonCombinedLogController.php +++ b/src/applications/daemon/controller/combined/PhabricatorDaemonCombinedLogController.php @@ -37,6 +37,7 @@ class PhabricatorDaemonCombinedLogController $event_view = new PhabricatorDaemonLogEventsView(); $event_view->setEvents($events); + $event_view->setUser($request->getUser()); $event_view->setCombinedLog(true); $log_panel = new AphrontPanelView(); diff --git a/src/applications/daemon/controller/console/PhabricatorDaemonConsoleController.php b/src/applications/daemon/controller/console/PhabricatorDaemonConsoleController.php index c9b5d8960d..b9f88b4c59 100644 --- a/src/applications/daemon/controller/console/PhabricatorDaemonConsoleController.php +++ b/src/applications/daemon/controller/console/PhabricatorDaemonConsoleController.php @@ -22,7 +22,11 @@ class PhabricatorDaemonConsoleController extends PhabricatorDaemonController { $logs = id(new PhabricatorDaemonLog())->loadAllWhere( '1 = 1 ORDER BY id DESC LIMIT 15'); + $request = $this->getRequest(); + $user = $request->getUser(); + $daemon_table = new PhabricatorDaemonLogListView(); + $daemon_table->setUser($user); $daemon_table->setDaemonLogs($logs); $daemon_panel = new AphrontPanelView(); diff --git a/src/applications/daemon/controller/loglist/PhabricatorDaemonLogListController.php b/src/applications/daemon/controller/loglist/PhabricatorDaemonLogListController.php index 1d44639026..eb69979409 100644 --- a/src/applications/daemon/controller/loglist/PhabricatorDaemonLogListController.php +++ b/src/applications/daemon/controller/loglist/PhabricatorDaemonLogListController.php @@ -33,6 +33,7 @@ class PhabricatorDaemonLogListController extends PhabricatorDaemonController { $pager->setURI($request->getRequestURI(), 'page'); $daemon_table = new PhabricatorDaemonLogListView(); + $daemon_table->setUser($request->getUser()); $daemon_table->setDaemonLogs($logs); $daemon_panel = new AphrontPanelView(); diff --git a/src/applications/daemon/controller/logview/PhabricatorDaemonLogViewController.php b/src/applications/daemon/controller/logview/PhabricatorDaemonLogViewController.php index 8d46e21b98..ffb95ecd9e 100644 --- a/src/applications/daemon/controller/logview/PhabricatorDaemonLogViewController.php +++ b/src/applications/daemon/controller/logview/PhabricatorDaemonLogViewController.php @@ -59,7 +59,8 @@ class PhabricatorDaemonLogViewController extends PhabricatorDaemonController { ->appendChild( id(new AphrontFormStaticControl()) ->setLabel('Started') - ->setValue(date('F jS, Y g:i:s A', $log->getDateCreated()))) + ->setValue( + phabricator_datetime($log->getDateCreated(), $user))) ->appendChild( id(new AphrontFormTextAreaControl()) ->setLabel('Argv') @@ -73,6 +74,7 @@ class PhabricatorDaemonLogViewController extends PhabricatorDaemonController { $content[] = $panel; $event_view = new PhabricatorDaemonLogEventsView(); + $event_view->setUser($user); $event_view->setEvents($events); $log_panel = new AphrontPanelView(); diff --git a/src/applications/daemon/controller/logview/__init__.php b/src/applications/daemon/controller/logview/__init__.php index 8ddc17864a..5d234e47e1 100644 --- a/src/applications/daemon/controller/logview/__init__.php +++ b/src/applications/daemon/controller/logview/__init__.php @@ -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/textarea'); phutil_require_module('phabricator', 'view/layout/panel'); +phutil_require_module('phabricator', 'view/utils'); phutil_require_module('phutil', 'utils'); diff --git a/src/applications/daemon/view/daemonlogevents/PhabricatorDaemonLogEventsView.php b/src/applications/daemon/view/daemonlogevents/PhabricatorDaemonLogEventsView.php index a8c0a72814..dd09781683 100644 --- a/src/applications/daemon/view/daemonlogevents/PhabricatorDaemonLogEventsView.php +++ b/src/applications/daemon/view/daemonlogevents/PhabricatorDaemonLogEventsView.php @@ -20,6 +20,7 @@ final class PhabricatorDaemonLogEventsView extends AphrontView { private $events; private $combinedLog; + private $user; public function setEvents(array $events) { $this->events = $events; @@ -29,14 +30,23 @@ final class PhabricatorDaemonLogEventsView extends AphrontView { $this->combinedLog = $is_combined; } + public function setUser(PhabricatorUser $user) { + $this->user = $user; + return $this; + } + public function render() { $rows = array(); + if (!$this->user) { + throw new Exception("Call setUser() before rendering!"); + } + foreach ($this->events as $event) { $row = array( phutil_escape_html($event->getLogType()), - date('M j, Y', $event->getEpoch()), - date('g:i:s A', $event->getEpoch()), + phabricator_date($event->getEpoch(), $this->user), + phabricator_time($event->getEpoch(), $this->user), str_replace("\n", '
', phutil_escape_html($event->getMessage())), ); diff --git a/src/applications/daemon/view/daemonlogevents/__init__.php b/src/applications/daemon/view/daemonlogevents/__init__.php index 29eecc7ec3..dd4e977647 100644 --- a/src/applications/daemon/view/daemonlogevents/__init__.php +++ b/src/applications/daemon/view/daemonlogevents/__init__.php @@ -8,6 +8,7 @@ phutil_require_module('phabricator', 'view/base'); phutil_require_module('phabricator', 'view/control/table'); +phutil_require_module('phabricator', 'view/utils'); phutil_require_module('phutil', 'markup'); diff --git a/src/applications/daemon/view/daemonloglist/PhabricatorDaemonLogListView.php b/src/applications/daemon/view/daemonloglist/PhabricatorDaemonLogListView.php index d0c882ef0c..1a4481ab48 100644 --- a/src/applications/daemon/view/daemonloglist/PhabricatorDaemonLogListView.php +++ b/src/applications/daemon/view/daemonloglist/PhabricatorDaemonLogListView.php @@ -19,14 +19,24 @@ final class PhabricatorDaemonLogListView extends AphrontView { private $daemonLogs; + private $user; public function setDaemonLogs(array $daemon_logs) { $this->daemonLogs = $daemon_logs; } + public function setUser(PhabricatorUser $user) { + $this->user = $user; + return $this; + } + public function render() { $rows = array(); + if (!$this->user) { + throw new Exception("Call setUser() before rendering!"); + } + foreach ($this->daemonLogs as $log) { $epoch = $log->getDateCreated(); @@ -73,8 +83,8 @@ final class PhabricatorDaemonLogListView extends AphrontView { phutil_escape_html($log->getDaemon()), phutil_escape_html($log->getHost()), $log->getPID(), - date('M j, Y', $epoch), - date('g:i A', $epoch), + phabricator_date($epoch, $this->user), + phabricator_time($epoch, $this->user), phutil_render_tag( 'a', array( diff --git a/src/applications/daemon/view/daemonloglist/__init__.php b/src/applications/daemon/view/daemonloglist/__init__.php index 3be004735f..0cb14d1492 100644 --- a/src/applications/daemon/view/daemonloglist/__init__.php +++ b/src/applications/daemon/view/daemonloglist/__init__.php @@ -8,6 +8,7 @@ phutil_require_module('phabricator', 'view/base'); phutil_require_module('phabricator', 'view/control/table'); +phutil_require_module('phabricator', 'view/utils'); phutil_require_module('phutil', 'markup'); diff --git a/src/applications/differential/controller/commentpreview/DifferentialCommentPreviewController.php b/src/applications/differential/controller/commentpreview/DifferentialCommentPreviewController.php index 96b04844ab..74b57a6211 100644 --- a/src/applications/differential/controller/commentpreview/DifferentialCommentPreviewController.php +++ b/src/applications/differential/controller/commentpreview/DifferentialCommentPreviewController.php @@ -42,6 +42,7 @@ class DifferentialCommentPreviewController extends DifferentialController { $comment->setAuthorPHID($author_phid); $view = new DifferentialRevisionCommentView(); + $view->setUser($request->getUser()); $view->setComment($comment); $view->setHandles($handles); $view->setMarkupEngine($engine); diff --git a/src/applications/differential/view/revisioncomment/DifferentialRevisionCommentView.php b/src/applications/differential/view/revisioncomment/DifferentialRevisionCommentView.php index 73f07f0973..7b08c5d85d 100644 --- a/src/applications/differential/view/revisioncomment/DifferentialRevisionCommentView.php +++ b/src/applications/differential/view/revisioncomment/DifferentialRevisionCommentView.php @@ -26,6 +26,7 @@ final class DifferentialRevisionCommentView extends AphrontView { private $changesets; private $target; private $commentNumber; + private $user; public function setComment($comment) { $this->comment = $comment; @@ -67,8 +68,17 @@ final class DifferentialRevisionCommentView extends AphrontView { return $this; } + public function setUser(PhabricatorUser $user) { + $this->user = $user; + return $this; + } + public function render() { + if (!$this->user) { + throw new Exception("Call setUser() before rendering!"); + } + require_celerity_resource('phabricator-remarkup-css'); require_celerity_resource('differential-revision-comment-css'); @@ -81,7 +91,7 @@ final class DifferentialRevisionCommentView extends AphrontView { if ($this->preview) { $date = 'COMMENT PREVIEW'; } else { - $date = date('F jS, Y g:i:s A', $comment->getDateCreated()); + $date = phabricator_datetime($comment->getDateCreated(), $this->user); } $info = array($date); diff --git a/src/applications/differential/view/revisioncomment/__init__.php b/src/applications/differential/view/revisioncomment/__init__.php index d240fa85ca..f105a69222 100644 --- a/src/applications/differential/view/revisioncomment/__init__.php +++ b/src/applications/differential/view/revisioncomment/__init__.php @@ -11,6 +11,7 @@ phutil_require_module('phabricator', 'applications/differential/storage/comment' phutil_require_module('phabricator', 'infrastructure/celerity/api'); phutil_require_module('phabricator', 'infrastructure/javelin/api'); phutil_require_module('phabricator', 'view/base'); +phutil_require_module('phabricator', 'view/utils'); phutil_require_module('phutil', 'markup'); phutil_require_module('phutil', 'utils'); diff --git a/src/applications/differential/view/revisioncommentlist/DifferentialRevisionCommentListView.php b/src/applications/differential/view/revisioncommentlist/DifferentialRevisionCommentListView.php index 23a24b0141..4ca1901a58 100644 --- a/src/applications/differential/view/revisioncommentlist/DifferentialRevisionCommentListView.php +++ b/src/applications/differential/view/revisioncommentlist/DifferentialRevisionCommentListView.php @@ -68,6 +68,7 @@ final class DifferentialRevisionCommentListView extends AphrontView { foreach ($this->comments as $comment) { $view = new DifferentialRevisionCommentView(); $view->setComment($comment); + $view->setUser($this->user); $view->setHandles($this->handles); $view->setMarkupEngine($engine); $view->setInlineComments(idx($inlines, $comment->getID(), array())); diff --git a/src/applications/files/controller/view/PhabricatorFileViewController.php b/src/applications/files/controller/view/PhabricatorFileViewController.php index 7a75e26ff3..b13acb5b19 100644 --- a/src/applications/files/controller/view/PhabricatorFileViewController.php +++ b/src/applications/files/controller/view/PhabricatorFileViewController.php @@ -28,6 +28,9 @@ class PhabricatorFileViewController extends PhabricatorFileController { public function processRequest() { + $request = $this->getRequest(); + $user = $request->getUser(); + $file = id(new PhabricatorFile())->loadOneWhere( 'phid = %s', $this->phid); @@ -93,7 +96,7 @@ class PhabricatorFileViewController extends PhabricatorFileController { id(new AphrontFormStaticControl()) ->setLabel('Created') ->setName('created') - ->setValue(date('Y-m-d g:i:s A', $file->getDateCreated()))) + ->setValue(phabricator_datetime($file->getDateCreated(), $user))) ->appendChild( id(new AphrontFormStaticControl()) ->setLabel('Mime Type') diff --git a/src/applications/files/controller/view/__init__.php b/src/applications/files/controller/view/__init__.php index 6f1fdac61b..36cba91615 100644 --- a/src/applications/files/controller/view/__init__.php +++ b/src/applications/files/controller/view/__init__.php @@ -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/submit'); phutil_require_module('phabricator', 'view/layout/panel'); +phutil_require_module('phabricator', 'view/utils'); phutil_require_module('phutil', 'markup'); phutil_require_module('phutil', 'utils'); diff --git a/src/applications/maniphest/controller/descriptionchange/ManiphestTaskDescriptionChangeController.php b/src/applications/maniphest/controller/descriptionchange/ManiphestTaskDescriptionChangeController.php index 11c5909f26..4c8f5004a1 100644 --- a/src/applications/maniphest/controller/descriptionchange/ManiphestTaskDescriptionChangeController.php +++ b/src/applications/maniphest/controller/descriptionchange/ManiphestTaskDescriptionChangeController.php @@ -50,6 +50,7 @@ class ManiphestTaskDescriptionChangeController extends ManiphestController { $view = new ManiphestTransactionDetailView(); $view->setTransactionGroup($transactions); $view->setHandles($handles); + $view->setUser($user); $view->setMarkupEngine($engine); $view->setRenderSummaryOnly(true); $view->setRenderFullSummary(true); diff --git a/src/applications/maniphest/controller/tasklist/ManiphestTaskListController.php b/src/applications/maniphest/controller/tasklist/ManiphestTaskListController.php index 1d0e5f2135..7d008a13cd 100644 --- a/src/applications/maniphest/controller/tasklist/ManiphestTaskListController.php +++ b/src/applications/maniphest/controller/tasklist/ManiphestTaskListController.php @@ -160,6 +160,7 @@ class ManiphestTaskListController extends ManiphestController { } else { foreach ($tasks as $group => $list) { $task_list = new ManiphestTaskListView(); + $task_list->setUser($user); $task_list->setTasks($list); $task_list->setHandles($handles); diff --git a/src/applications/maniphest/view/tasklist/ManiphestTaskListView.php b/src/applications/maniphest/view/tasklist/ManiphestTaskListView.php index 8234ad3967..0e01aefb96 100644 --- a/src/applications/maniphest/view/tasklist/ManiphestTaskListView.php +++ b/src/applications/maniphest/view/tasklist/ManiphestTaskListView.php @@ -20,6 +20,7 @@ class ManiphestTaskListView extends AphrontView { private $tasks; private $handles; + private $user; public function setTasks(array $tasks) { $this->tasks = $tasks; @@ -31,12 +32,18 @@ class ManiphestTaskListView extends AphrontView { return $this; } + public function setUser(PhabricatorUser $user) { + $this->user = $user; + return $this; + } + public function render() { $views = array(); foreach ($this->tasks as $task) { $view = new ManiphestTaskSummaryView(); $view->setTask($task); + $view->setUser($this->user); $view->setHandles($this->handles); $views[] = $view->render(); } diff --git a/src/applications/maniphest/view/tasksummary/ManiphestTaskSummaryView.php b/src/applications/maniphest/view/tasksummary/ManiphestTaskSummaryView.php index b1ea5352b7..7cad3d02a8 100644 --- a/src/applications/maniphest/view/tasksummary/ManiphestTaskSummaryView.php +++ b/src/applications/maniphest/view/tasksummary/ManiphestTaskSummaryView.php @@ -20,6 +20,7 @@ class ManiphestTaskSummaryView extends AphrontView { private $task; private $handles; + private $user; public function setTask(ManiphestTask $task) { $this->task = $task; @@ -31,7 +32,17 @@ class ManiphestTaskSummaryView extends AphrontView { return $this; } + public function setUser(PhabricatorUser $user) { + $this->user = $user; + return $this; + } + public function render() { + + if (!$this->user) { + throw new Exception("Call setUser() before rendering!"); + } + $task = $this->task; $handles = $this->handles; @@ -76,7 +87,7 @@ class ManiphestTaskSummaryView extends AphrontView { ManiphestTaskPriority::getTaskPriorityName($task->getPriority()). ''. ''. - phabricator_format_timestamp($task->getDateModified()). + phabricator_datetime($task->getDateModified(), $this->user). ''. ''. ''; diff --git a/src/applications/maniphest/view/transactiondetail/ManiphestTransactionDetailView.php b/src/applications/maniphest/view/transactiondetail/ManiphestTransactionDetailView.php index f702a04125..243ee7eae9 100644 --- a/src/applications/maniphest/view/transactiondetail/ManiphestTransactionDetailView.php +++ b/src/applications/maniphest/view/transactiondetail/ManiphestTransactionDetailView.php @@ -27,6 +27,7 @@ class ManiphestTransactionDetailView extends AphrontView { private $renderSummaryOnly; private $renderFullSummary; + private $user; public function setTransactionGroup(array $transactions) { $this->transactions = $transactions; @@ -71,6 +72,11 @@ class ManiphestTransactionDetailView extends AphrontView { return $this; } + public function setUser(PhabricatorUser $user) { + $this->user = $user; + return $this; + } + public function renderForEmail($with_date) { $this->forEmail = true; @@ -87,8 +93,11 @@ class ManiphestTransactionDetailView extends AphrontView { } $desc = $author.' '.$desc.'.'; if ($with_date) { - $desc = 'On '.date('M jS \a\t g:i A', $transaction->getDateCreated()). - ', '.$desc; + // NOTE: This is going into a (potentially multi-recipient) email so + // 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; if ($transaction->hasComments()) { @@ -114,6 +123,11 @@ class ManiphestTransactionDetailView extends AphrontView { } public function render() { + + if (!$this->user) { + throw new Exception("Call setUser() before render()!"); + } + $handles = $this->handles; $transactions = $this->transactions; @@ -177,7 +191,9 @@ class ManiphestTransactionDetailView extends AphrontView { if ($this->preview) { $timestamp = 'COMMENT PREVIEW'; } else { - $timestamp = phabricator_format_timestamp($transaction->getDateCreated()); + $timestamp = phabricator_datetime( + $transaction->getDateCreated(), + $this->user); } $info = array(); diff --git a/src/applications/maniphest/view/transactionlist/ManiphestTransactionListView.php b/src/applications/maniphest/view/transactionlist/ManiphestTransactionListView.php index ef95eecb0b..f2a33a1235 100644 --- a/src/applications/maniphest/view/transactionlist/ManiphestTransactionListView.php +++ b/src/applications/maniphest/view/transactionlist/ManiphestTransactionListView.php @@ -80,6 +80,7 @@ class ManiphestTransactionListView extends AphrontView { $sequence = 1; foreach ($groups as $group) { $view = new ManiphestTransactionDetailView(); + $view->setUser($this->user); $view->setTransactionGroup($group); $view->setHandles($this->handles); $view->setMarkupEngine($this->markupEngine); diff --git a/src/applications/metamta/controller/list/PhabricatorMetaMTAListController.php b/src/applications/metamta/controller/list/PhabricatorMetaMTAListController.php index be4e328587..14904c65b1 100644 --- a/src/applications/metamta/controller/list/PhabricatorMetaMTAListController.php +++ b/src/applications/metamta/controller/list/PhabricatorMetaMTAListController.php @@ -21,6 +21,7 @@ class PhabricatorMetaMTAListController extends PhabricatorMetaMTAController { public function processRequest() { // Get a page of mails together with pager. $request = $this->getRequest(); + $user = $request->getUser(); $offset = $request->getInt('offset', 0); $related_phid = $request->getStr('phid'); @@ -60,7 +61,7 @@ class PhabricatorMetaMTAListController extends PhabricatorMetaMTAController { PhabricatorMetaMTAMail::getReadableStatus($mail->getStatus()), $mail->getRetryCount(), ($mail->getNextRetry() - time()).' s', - date('Y-m-d g:i:s A', $mail->getDateCreated()), + phabricator_datetime($mail->getDateCreated(), $user), (time() - $mail->getDateModified()).' s', phutil_escape_html($mail->getSubject()), phutil_render_tag( diff --git a/src/applications/metamta/controller/list/__init__.php b/src/applications/metamta/controller/list/__init__.php index 49a41c7b7f..c83288dc45 100644 --- a/src/applications/metamta/controller/list/__init__.php +++ b/src/applications/metamta/controller/list/__init__.php @@ -13,6 +13,7 @@ phutil_require_module('phabricator', 'storage/queryfx'); phutil_require_module('phabricator', 'view/control/pager'); phutil_require_module('phabricator', 'view/control/table'); phutil_require_module('phabricator', 'view/layout/panel'); +phutil_require_module('phabricator', 'view/utils'); phutil_require_module('phutil', 'markup'); diff --git a/src/view/utils/viewutils.php b/src/view/utils/viewutils.php index 3c18d95154..97fc5c3cb3 100644 --- a/src/view/utils/viewutils.php +++ b/src/view/utils/viewutils.php @@ -18,19 +18,22 @@ function phabricator_date($epoch, $user) { $zone = new DateTimeZone($user->getTimezoneIdentifier()); - $date = new DateTime('@'.$epoch, $zone); + $date = new DateTime('@'.$epoch); + $date->setTimeZone($zone); return $date->format('M j Y'); } function phabricator_time($epoch, $user) { $zone = new DateTimeZone($user->getTimezoneIdentifier()); - $date = new DateTime('@'.$epoch, $zone); + $date = new DateTime('@'.$epoch); + $date->setTimeZone($zone); return $date->format('g:i A'); } function phabricator_datetime($epoch, $user) { $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'); } diff --git a/webroot/rsrc/css/application/maniphest/task-summary.css b/webroot/rsrc/css/application/maniphest/task-summary.css index a2bd5dcd1a..f9072a7788 100644 --- a/webroot/rsrc/css/application/maniphest/task-summary.css +++ b/webroot/rsrc/css/application/maniphest/task-summary.css @@ -49,8 +49,8 @@ .maniphest-task-summary td.maniphest-task-updated { text-align: left; - width: 11%; - min-width: 120px; + width: 13%; + min-width: 160px; } .maniphest-task-summary .pri-bullet {