@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix displaying of user status

Summary:
This fixes two separate issues:

# `getTextStatus()` is used for machine readable data in handles and user.info method. Broken since D3810.
# Status may contain date. Broken since beginning but masked by the fact that CSS ignores unknown class names.

Test Plan:
Displayed revision with reviewer away.
Called `user.addstatus`.
Edited status in calendar.

Reviewers: btrahan, epriestley

Reviewed By: epriestley

CC: nh, aran, Korvin

Differential Revision: https://secure.phabricator.com/D4275

vrana f2639e52 1264e385

+23 -9
+1 -1
src/applications/calendar/controller/PhabricatorCalendarBrowseController.php
··· 36 36 $event->setEpochRange($status->getDateFrom(), $status->getDateTo()); 37 37 38 38 $name_text = $handles[$status->getUserPHID()]->getName(); 39 - $status_text = $status->getTextStatus(); 39 + $status_text = $status->getHumanStatus(); 40 40 $event->setUserPHID($status->getUserPHID()); 41 41 $event->setName("{$name_text} ({$status_text})"); 42 42 $details = '';
+1 -1
src/applications/people/conduit/ConduitAPI_user_addstatus_Method.php
··· 38 38 $user_phid = $request->getUser()->getPHID(); 39 39 $from = $request->getValue('fromEpoch'); 40 40 $to = $request->getValue('toEpoch'); 41 - $status = ucfirst($request->getValue('status')); 41 + $status = $request->getValue('status'); 42 42 $description = $request->getValue('description', ''); 43 43 44 44 try {
+11 -2
src/applications/people/storage/PhabricatorUserStatus.php
··· 11 11 const STATUS_AWAY = 1; 12 12 const STATUS_SPORADIC = 2; 13 13 14 + private static $statusTexts = array( 15 + self::STATUS_AWAY => 'away', 16 + self::STATUS_SPORADIC => 'sporadic', 17 + ); 18 + 19 + public function getTextStatus() { 20 + return self::$statusTexts[$this->status]; 21 + } 22 + 14 23 public function getStatusOptions() { 15 24 return array( 16 25 self::STATUS_AWAY => pht('Away'), ··· 18 27 ); 19 28 } 20 29 21 - public function getTextStatus() { 30 + public function getHumanStatus() { 22 31 $options = $this->getStatusOptions(); 23 32 return $options[$this->status]; 24 33 } ··· 33 42 } 34 43 35 44 public function setTextStatus($status) { 36 - $statuses = array_flip($this->getStatusOptions()); 45 + $statuses = array_flip(self::$statusTexts); 37 46 return $this->setStatus($statuses[$status]); 38 47 } 39 48
+7 -1
src/applications/phid/PhabricatorObjectHandle.php
··· 12 12 private $timestamp; 13 13 private $alternateID; 14 14 private $status = PhabricatorObjectHandleStatus::STATUS_OPEN; 15 + private $title; 15 16 private $complete; 16 17 private $disabled; 17 18 ··· 49 50 50 51 public function getStatus() { 51 52 return $this->status; 53 + } 54 + 55 + public function setTitle($title) { 56 + $this->title = $title; 57 + return $this; 52 58 } 53 59 54 60 public function setFullName($full_name) { ··· 176 182 177 183 if ($this->status != PhabricatorObjectHandleStatus::STATUS_OPEN) { 178 184 $class .= ' handle-status-'.$this->status; 179 - $title = $this->status; 185 + $title = (isset($this->title) ? $this->title : $this->status); 180 186 } 181 187 182 188 if ($this->disabled) {
+3 -4
src/applications/phid/handle/PhabricatorObjectHandleData.php
··· 223 223 $handle->setAlternateID($user->getID()); 224 224 $handle->setComplete(true); 225 225 if (isset($statuses[$phid])) { 226 - $status = $statuses[$phid]->getTextStatus(); 226 + $handle->setStatus($statuses[$phid]->getTextStatus()); 227 227 if ($this->viewer) { 228 - $date = $statuses[$phid]->getDateTo(); 229 - $status .= ' until '.phabricator_date($date, $this->viewer); 228 + $handle->setTitle( 229 + $statuses[$phid]->getTerseSummary($this->viewer)); 230 230 } 231 - $handle->setStatus($status); 232 231 } 233 232 $handle->setDisabled($user->getIsDisabled()); 234 233