diff --git a/src/applications/people/conduit/UserConduitAPIMethod.php b/src/applications/people/conduit/UserConduitAPIMethod.php index 82da171f43..187e28b9b3 100644 --- a/src/applications/people/conduit/UserConduitAPIMethod.php +++ b/src/applications/people/conduit/UserConduitAPIMethod.php @@ -6,7 +6,10 @@ abstract class UserConduitAPIMethod extends ConduitAPIMethod { return PhabricatorApplication::getByClass('PhabricatorPeopleApplication'); } - protected function buildUserInformationDictionary(PhabricatorUser $user) { + protected function buildUserInformationDictionary( + PhabricatorUser $user, + $with_email = false, + $with_availability = false) { $roles = array(); if ($user->getIsDisabled()) { @@ -40,18 +43,23 @@ abstract class UserConduitAPIMethod extends ConduitAPIMethod { 'phid' => $user->getPHID(), 'userName' => $user->getUserName(), 'realName' => $user->getRealName(), - 'primaryEmail' => $email, 'image' => $user->getProfileImageURI(), 'uri' => PhabricatorEnv::getURI('/p/'.$user->getUsername().'/'), 'roles' => $roles, ); - // TODO: Modernize this once we have a more long-term view of what the - // data looks like. - $until = $user->getAwayUntil(); - if ($until) { - $return['currentStatus'] = 'away'; - $return['currentStatusUntil'] = $until; + if ($with_email) { + $return['primaryEmail'] = $email; + } + + if ($with_availability) { + // TODO: Modernize this once we have a more long-term view of what the + // data looks like. + $until = $user->getAwayUntil(); + if ($until) { + $return['currentStatus'] = 'away'; + $return['currentStatusUntil'] = $until; + } } return $return; diff --git a/src/applications/people/conduit/UserQueryConduitAPIMethod.php b/src/applications/people/conduit/UserQueryConduitAPIMethod.php index c480ae0c73..4a567a0158 100644 --- a/src/applications/people/conduit/UserQueryConduitAPIMethod.php +++ b/src/applications/people/conduit/UserQueryConduitAPIMethod.php @@ -71,7 +71,10 @@ final class UserQueryConduitAPIMethod extends UserConduitAPIMethod { $results = array(); foreach ($users as $user) { - $results[] = $this->buildUserInformationDictionary($user); + $results[] = $this->buildUserInformationDictionary( + $user, + $with_email = false, + $with_availability = true); } return $results; } diff --git a/src/applications/people/conduit/UserWhoAmIConduitAPIMethod.php b/src/applications/people/conduit/UserWhoAmIConduitAPIMethod.php index aa7e3e7f26..b646246c5d 100644 --- a/src/applications/people/conduit/UserWhoAmIConduitAPIMethod.php +++ b/src/applications/people/conduit/UserWhoAmIConduitAPIMethod.php @@ -29,7 +29,10 @@ final class UserWhoAmIConduitAPIMethod extends UserConduitAPIMethod { ->withPHIDs(array($request->getUser()->getPHID())) ->executeOne(); - return $this->buildUserInformationDictionary($person); + return $this->buildUserInformationDictionary( + $person, + $with_email = true, + $with_availability = false); } }