1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-30 02:32:42 +01:00

Display away data in revision fields

Summary:
Ball is more obvious and visible than I thought.
Delete the status word and display until date in title.

Also display the until date in revision list.
Also display near future dates with DoW instead of year.

Test Plan: Displayed revision and revision list with away reviewers.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3407
This commit is contained in:
vrana 2012-08-30 10:50:41 -07:00
parent 7cfad01ce3
commit 1752435255
5 changed files with 18 additions and 21 deletions

View file

@ -172,7 +172,9 @@ final class DifferentialRevisionListController extends DifferentialController {
}
$phids = array_mergev(mpull($view_objects, 'getRequiredHandlePHIDs'));
$phids[] = $params['phid'];
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
$handles = id(new PhabricatorObjectHandleData($phids))
->setViewer($this->getRequest()->getUser())
->loadHandles();
foreach ($views as $view) {
if (empty($view['special'])) {

View file

@ -144,6 +144,7 @@ final class DifferentialRevisionViewController extends DifferentialController {
$object_phids = array_unique($object_phids);
$handles = id(new PhabricatorObjectHandleData($object_phids))
->setViewer($this->getRequest()->getUser())
->loadHandles();
foreach ($aux_fields as $key => $aux_field) {
@ -879,7 +880,9 @@ final class DifferentialRevisionViewController extends DifferentialController {
->loadAssets();
$phids = $view->getRequiredHandlePHIDs();
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
$handles = id(new PhabricatorObjectHandleData($phids))
->setViewer($this->getRequest()->getUser())
->loadHandles();
$view->setHandles($handles);
return

View file

@ -278,25 +278,10 @@ abstract class DifferentialFieldSpecification {
return '<em>None</em>';
}
$statuses = id(new PhabricatorUserStatus())->loadCurrentStatuses(
$user_phids);
$links = array();
foreach ($user_phids as $user_phid) {
$handle = $this->getHandle($user_phid);
$extra = null;
$status = idx($statuses, $handle->getPHID());
if ($handle->isDisabled()) {
$extra = ' <strong>(disabled)</strong>';
} else if ($status) {
$until = phabricator_date($status->getDateTo(), $this->getUser());
if ($status->getStatus() == PhabricatorUserStatus::STATUS_SPORADIC) {
$extra = ' <strong title="until '.$until.'">(sporadic)</strong>';
} else {
$extra = ' <strong title="until '.$until.'">(away)</strong>';
}
}
$links[] = $handle->renderLink().$extra;
$links[] = $handle->renderLink();
}
return implode(', ', $links);

View file

@ -177,7 +177,12 @@ final class PhabricatorObjectHandleData {
$handle->setAlternateID($user->getID());
$handle->setComplete(true);
if (isset($statuses[$phid])) {
$handle->setStatus($statuses[$phid]->getTextStatus());
$status = $statuses[$phid]->getTextStatus();
if ($this->viewer) {
$date = $statuses[$phid]->getDateTo();
$status .= ' until '.phabricator_date($date, $this->viewer);
}
$handle->setStatus($status);
}
$handle->setDisabled($user->getIsDisabled());

View file

@ -65,10 +65,12 @@ function phabricator_datetime($epoch, $user) {
}
function _phabricator_date_format($epoch) {
$format = pht('M j Y');
$now = time();
if ($epoch <= $now && $epoch > $now - 30 * 24 * 60 * 60) {
$shift = 30 * 24 * 60 * 60;
if ($epoch < $now + $shift && $epoch > $now - $shift) {
$format = pht('D, M j');
} else {
$format = pht('M j Y');
}
return $format;
}