Page MenuHomePhabricator

D12848.id30914.diff
No OneTemporary

D12848.id30914.diff

diff --git a/src/applications/people/conduit/UserConduitAPIMethod.php b/src/applications/people/conduit/UserConduitAPIMethod.php
--- a/src/applications/people/conduit/UserConduitAPIMethod.php
+++ b/src/applications/people/conduit/UserConduitAPIMethod.php
@@ -6,7 +6,10 @@
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 @@
'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
--- a/src/applications/people/conduit/UserQueryConduitAPIMethod.php
+++ b/src/applications/people/conduit/UserQueryConduitAPIMethod.php
@@ -71,7 +71,10 @@
$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
--- a/src/applications/people/conduit/UserWhoAmIConduitAPIMethod.php
+++ b/src/applications/people/conduit/UserWhoAmIConduitAPIMethod.php
@@ -29,7 +29,10 @@
->withPHIDs(array($request->getUser()->getPHID()))
->executeOne();
- return $this->buildUserInformationDictionary($person);
+ return $this->buildUserInformationDictionary(
+ $person,
+ $with_email = true,
+ $with_availability = false);
}
}

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 18, 10:48 PM (5 h, 34 m ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6737359
Default Alt Text
D12848.id30914.diff (2 KB)

Event Timeline