diff --git a/src/applications/people/controller/profile/PhabricatorPeopleProfileController.php b/src/applications/people/controller/profile/PhabricatorPeopleProfileController.php
index ff91c71758..a48d06508c 100644
--- a/src/applications/people/controller/profile/PhabricatorPeopleProfileController.php
+++ b/src/applications/people/controller/profile/PhabricatorPeopleProfileController.php
@@ -124,6 +124,17 @@ final class PhabricatorPeopleProfileController
->setName($user->getUserName().' ('.$user->getRealName().')')
->setDescription($profile->getTitle());
+ if ($user->getIsDisabled()) {
+ $header->setStatus('Disabled');
+ } else {
+ $status = id(new PhabricatorUserStatus())->loadOneWhere(
+ 'userPHID = %s AND UNIX_TIMESTAMP() BETWEEN dateFrom AND dateTo',
+ $user->getPHID());
+ if ($status) {
+ $header->setStatus($status->getStatusDescription());
+ }
+ }
+
$header->appendChild($nav);
$nav->appendChild(
'
'.$content.'
');
diff --git a/src/applications/people/controller/profile/__init__.php b/src/applications/people/controller/profile/__init__.php
index a4f50fdc45..ffd19751f7 100644
--- a/src/applications/people/controller/profile/__init__.php
+++ b/src/applications/people/controller/profile/__init__.php
@@ -15,6 +15,7 @@ phutil_require_module('phabricator', 'applications/people/controller/base');
phutil_require_module('phabricator', 'applications/people/storage/profile');
phutil_require_module('phabricator', 'applications/people/storage/user');
phutil_require_module('phabricator', 'applications/people/storage/useroauthinfo');
+phutil_require_module('phabricator', 'applications/people/storage/userstatus');
phutil_require_module('phabricator', 'infrastructure/celerity/api');
phutil_require_module('phabricator', 'view/layout/profileheader');
phutil_require_module('phabricator', 'view/layout/sidenavfilter');
diff --git a/src/applications/people/storage/userstatus/PhabricatorUserStatus.php b/src/applications/people/storage/userstatus/PhabricatorUserStatus.php
index ccc0bec46e..5586537e67 100644
--- a/src/applications/people/storage/userstatus/PhabricatorUserStatus.php
+++ b/src/applications/people/storage/userstatus/PhabricatorUserStatus.php
@@ -35,6 +35,15 @@ final class PhabricatorUserStatus extends PhabricatorUserDAO {
return self::$statusTexts[$this->status];
}
+ public function getStatusDescription(PhabricatorUser $viewer) {
+ $until = phabricator_date($this->dateTo, $viewer);
+ if ($this->status == PhabricatorUserStatus::STATUS_SPORADIC) {
+ return 'Sporadic until '.$until;
+ } else {
+ return 'Away until '.$until;
+ }
+ }
+
public function setTextStatus($status) {
$statuses = array_flip(self::$statusTexts);
return $this->setStatus($statuses[$status]);
diff --git a/src/applications/people/storage/userstatus/__init__.php b/src/applications/people/storage/userstatus/__init__.php
index 6fc2b42c54..ecdf37ac53 100644
--- a/src/applications/people/storage/userstatus/__init__.php
+++ b/src/applications/people/storage/userstatus/__init__.php
@@ -7,6 +7,7 @@
phutil_require_module('phabricator', 'applications/people/storage/base');
+phutil_require_module('phabricator', 'view/utils');
phutil_require_source('PhabricatorUserStatus.php');
diff --git a/src/view/layout/profileheader/PhabricatorProfileHeaderView.php b/src/view/layout/profileheader/PhabricatorProfileHeaderView.php
index 9bf7c9d103..c5b66d1889 100644
--- a/src/view/layout/profileheader/PhabricatorProfileHeaderView.php
+++ b/src/view/layout/profileheader/PhabricatorProfileHeaderView.php
@@ -22,6 +22,7 @@ final class PhabricatorProfileHeaderView extends AphrontView {
protected $profileName;
protected $profileDescription;
protected $profileActions = array();
+ protected $profileStatus;
public function setProfilePicture($picture) {
$this->profilePicture = $picture;
@@ -43,6 +44,11 @@ final class PhabricatorProfileHeaderView extends AphrontView {
return $this;
}
+ public function setStatus($status) {
+ $this->profileStatus = $status;
+ return $this;
+ }
+
public function render() {
require_celerity_resource('phabricator-profile-header-css');
@@ -57,6 +63,14 @@ final class PhabricatorProfileHeaderView extends AphrontView {
'');
}
+ $description = phutil_escape_html($this->profileDescription);
+ if ($this->profileStatus != '') {
+ $description =
+ ''.phutil_escape_html($this->profileStatus).''.
+ ($description != '' ? ' — ' : '').
+ $description;
+ }
+
return
''.