@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.

Display user status on user profile

Test Plan:
Display users with:

- Title.
- Status.
- Title and status.

Also display project.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran, epriestley

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

vrana d9b4fcb3 2476c872

+37 -1
+11
src/applications/people/controller/profile/PhabricatorPeopleProfileController.php
··· 124 124 ->setName($user->getUserName().' ('.$user->getRealName().')') 125 125 ->setDescription($profile->getTitle()); 126 126 127 + if ($user->getIsDisabled()) { 128 + $header->setStatus('Disabled'); 129 + } else { 130 + $status = id(new PhabricatorUserStatus())->loadOneWhere( 131 + 'userPHID = %s AND UNIX_TIMESTAMP() BETWEEN dateFrom AND dateTo', 132 + $user->getPHID()); 133 + if ($status) { 134 + $header->setStatus($status->getStatusDescription()); 135 + } 136 + } 137 + 127 138 $header->appendChild($nav); 128 139 $nav->appendChild( 129 140 '<div style="padding: 1em;">'.$content.'</div>');
+1
src/applications/people/controller/profile/__init__.php
··· 15 15 phutil_require_module('phabricator', 'applications/people/storage/profile'); 16 16 phutil_require_module('phabricator', 'applications/people/storage/user'); 17 17 phutil_require_module('phabricator', 'applications/people/storage/useroauthinfo'); 18 + phutil_require_module('phabricator', 'applications/people/storage/userstatus'); 18 19 phutil_require_module('phabricator', 'infrastructure/celerity/api'); 19 20 phutil_require_module('phabricator', 'view/layout/profileheader'); 20 21 phutil_require_module('phabricator', 'view/layout/sidenavfilter');
+9
src/applications/people/storage/userstatus/PhabricatorUserStatus.php
··· 35 35 return self::$statusTexts[$this->status]; 36 36 } 37 37 38 + public function getStatusDescription(PhabricatorUser $viewer) { 39 + $until = phabricator_date($this->dateTo, $viewer); 40 + if ($this->status == PhabricatorUserStatus::STATUS_SPORADIC) { 41 + return 'Sporadic until '.$until; 42 + } else { 43 + return 'Away until '.$until; 44 + } 45 + } 46 + 38 47 public function setTextStatus($status) { 39 48 $statuses = array_flip(self::$statusTexts); 40 49 return $this->setStatus($statuses[$status]);
+1
src/applications/people/storage/userstatus/__init__.php
··· 7 7 8 8 9 9 phutil_require_module('phabricator', 'applications/people/storage/base'); 10 + phutil_require_module('phabricator', 'view/utils'); 10 11 11 12 12 13 phutil_require_source('PhabricatorUserStatus.php');
+15 -1
src/view/layout/profileheader/PhabricatorProfileHeaderView.php
··· 22 22 protected $profileName; 23 23 protected $profileDescription; 24 24 protected $profileActions = array(); 25 + protected $profileStatus; 25 26 26 27 public function setProfilePicture($picture) { 27 28 $this->profilePicture = $picture; ··· 43 44 return $this; 44 45 } 45 46 47 + public function setStatus($status) { 48 + $this->profileStatus = $status; 49 + return $this; 50 + } 51 + 46 52 public function render() { 47 53 require_celerity_resource('phabricator-profile-header-css'); 48 54 ··· 57 63 ''); 58 64 } 59 65 66 + $description = phutil_escape_html($this->profileDescription); 67 + if ($this->profileStatus != '') { 68 + $description = 69 + '<strong>'.phutil_escape_html($this->profileStatus).'</strong>'. 70 + ($description != '' ? ' &mdash; ' : ''). 71 + $description; 72 + } 73 + 60 74 return 61 75 '<table class="phabricator-profile-header"> 62 76 <tr> ··· 72 86 </tr> 73 87 <tr> 74 88 <td class="profile-header-description">'. 75 - phutil_escape_html($this->profileDescription). 89 + $description. 76 90 '</td> 77 91 </tr> 78 92 </table>'.