diff --git a/src/applications/calendar/controller/PhabricatorCalendarBrowseController.php b/src/applications/calendar/controller/PhabricatorCalendarBrowseController.php index ec6143b324..41faebe319 100644 --- a/src/applications/calendar/controller/PhabricatorCalendarBrowseController.php +++ b/src/applications/calendar/controller/PhabricatorCalendarBrowseController.php @@ -36,7 +36,7 @@ final class PhabricatorCalendarBrowseController $event->setEpochRange($status->getDateFrom(), $status->getDateTo()); $name_text = $handles[$status->getUserPHID()]->getName(); - $status_text = $status->getTextStatus(); + $status_text = $status->getHumanStatus(); $event->setUserPHID($status->getUserPHID()); $event->setName("{$name_text} ({$status_text})"); $details = ''; diff --git a/src/applications/people/conduit/ConduitAPI_user_addstatus_Method.php b/src/applications/people/conduit/ConduitAPI_user_addstatus_Method.php index da64d4ce2c..0e8b206fe3 100644 --- a/src/applications/people/conduit/ConduitAPI_user_addstatus_Method.php +++ b/src/applications/people/conduit/ConduitAPI_user_addstatus_Method.php @@ -38,7 +38,7 @@ final class ConduitAPI_user_addstatus_Method extends ConduitAPI_user_Method { $user_phid = $request->getUser()->getPHID(); $from = $request->getValue('fromEpoch'); $to = $request->getValue('toEpoch'); - $status = ucfirst($request->getValue('status')); + $status = $request->getValue('status'); $description = $request->getValue('description', ''); try { diff --git a/src/applications/people/storage/PhabricatorUserStatus.php b/src/applications/people/storage/PhabricatorUserStatus.php index af765da39f..8b771ae33d 100644 --- a/src/applications/people/storage/PhabricatorUserStatus.php +++ b/src/applications/people/storage/PhabricatorUserStatus.php @@ -11,6 +11,15 @@ final class PhabricatorUserStatus extends PhabricatorUserDAO { const STATUS_AWAY = 1; const STATUS_SPORADIC = 2; + private static $statusTexts = array( + self::STATUS_AWAY => 'away', + self::STATUS_SPORADIC => 'sporadic', + ); + + public function getTextStatus() { + return self::$statusTexts[$this->status]; + } + public function getStatusOptions() { return array( self::STATUS_AWAY => pht('Away'), @@ -18,7 +27,7 @@ final class PhabricatorUserStatus extends PhabricatorUserDAO { ); } - public function getTextStatus() { + public function getHumanStatus() { $options = $this->getStatusOptions(); return $options[$this->status]; } @@ -33,7 +42,7 @@ final class PhabricatorUserStatus extends PhabricatorUserDAO { } public function setTextStatus($status) { - $statuses = array_flip($this->getStatusOptions()); + $statuses = array_flip(self::$statusTexts); return $this->setStatus($statuses[$status]); } diff --git a/src/applications/phid/PhabricatorObjectHandle.php b/src/applications/phid/PhabricatorObjectHandle.php index a9a94c388b..7fd232c385 100644 --- a/src/applications/phid/PhabricatorObjectHandle.php +++ b/src/applications/phid/PhabricatorObjectHandle.php @@ -12,6 +12,7 @@ final class PhabricatorObjectHandle { private $timestamp; private $alternateID; private $status = PhabricatorObjectHandleStatus::STATUS_OPEN; + private $title; private $complete; private $disabled; @@ -51,6 +52,11 @@ final class PhabricatorObjectHandle { return $this->status; } + public function setTitle($title) { + $this->title = $title; + return $this; + } + public function setFullName($full_name) { $this->fullName = $full_name; return $this; @@ -176,7 +182,7 @@ final class PhabricatorObjectHandle { if ($this->status != PhabricatorObjectHandleStatus::STATUS_OPEN) { $class .= ' handle-status-'.$this->status; - $title = $this->status; + $title = (isset($this->title) ? $this->title : $this->status); } if ($this->disabled) { diff --git a/src/applications/phid/handle/PhabricatorObjectHandleData.php b/src/applications/phid/handle/PhabricatorObjectHandleData.php index 937d5d0dd9..4cba669f1a 100644 --- a/src/applications/phid/handle/PhabricatorObjectHandleData.php +++ b/src/applications/phid/handle/PhabricatorObjectHandleData.php @@ -223,12 +223,11 @@ final class PhabricatorObjectHandleData { $handle->setAlternateID($user->getID()); $handle->setComplete(true); if (isset($statuses[$phid])) { - $status = $statuses[$phid]->getTextStatus(); + $handle->setStatus($statuses[$phid]->getTextStatus()); if ($this->viewer) { - $date = $statuses[$phid]->getDateTo(); - $status .= ' until '.phabricator_date($date, $this->viewer); + $handle->setTitle( + $statuses[$phid]->getTerseSummary($this->viewer)); } - $handle->setStatus($status); } $handle->setDisabled($user->getIsDisabled());