Changeset View
Changeset View
Standalone View
Standalone View
src/applications/people/phid/PhabricatorPeopleUserPHIDType.php
Show All 37 Lines | public function loadHandles( | ||||
foreach ($handles as $phid => $handle) { | foreach ($handles as $phid => $handle) { | ||||
$user = $objects[$phid]; | $user = $objects[$phid]; | ||||
$realname = $user->getRealName(); | $realname = $user->getRealName(); | ||||
$handle->setName($user->getUsername()); | $handle->setName($user->getUsername()); | ||||
$handle->setURI('/p/'.$user->getUsername().'/'); | $handle->setURI('/p/'.$user->getUsername().'/'); | ||||
$handle->setFullName($user->getFullName()); | $handle->setFullName($user->getFullName()); | ||||
$handle->setImageURI($user->getProfileImageURI()); | $handle->setImageURI($user->getProfileImageURI()); | ||||
$handle->setDisabled(!$user->isUserActivated()); | |||||
$availability = null; | |||||
if (!$user->isUserActivated()) { | |||||
$availability = PhabricatorObjectHandle::AVAILABILITY_DISABLED; | |||||
} else { | |||||
if ($user->hasStatus()) { | if ($user->hasStatus()) { | ||||
$status = $user->getStatus(); | // NOTE: This first call returns an event; then we get the event | ||||
$handle->setStatus($status->getTextStatus()); | // status. | ||||
$handle->setTitle($status->getTerseSummary($query->getViewer())); | $status = $user->getStatus()->getStatus(); | ||||
switch ($status) { | |||||
case PhabricatorCalendarEvent::STATUS_AWAY: | |||||
$availability = PhabricatorObjectHandle::AVAILABILITY_NONE; | |||||
break; | |||||
case PhabricatorCalendarEvent::STATUS_SPORADIC: | |||||
$availability = PhabricatorObjectHandle::AVAILABILITY_PARTIAL; | |||||
break; | |||||
} | |||||
} | |||||
} | |||||
if ($availability) { | |||||
$handle->setAvailability($availability); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
public function canLoadNamedObject($name) { | public function canLoadNamedObject($name) { | ||||
return preg_match('/^@.+/', $name); | return preg_match('/^@.+/', $name); | ||||
} | } | ||||
Show All 29 Lines |