@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 an issue with user.whoami

Summary:
Both user.whoami and user.query call the same wire formatting code, but expect different data.

Don't try to add availability data to user.whoami.

Stop adding email data to user.query. We've added it since D11791, but my intent was for it to be exposed //only// via user.whoami (i.e., expose your address, not others').

Test Plan:
- Called both methods.
- Saw emails on user.whoami.
- Saw availability on user.query.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

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

+24 -10
+16 -8
src/applications/people/conduit/UserConduitAPIMethod.php
··· 6 6 return PhabricatorApplication::getByClass('PhabricatorPeopleApplication'); 7 7 } 8 8 9 - protected function buildUserInformationDictionary(PhabricatorUser $user) { 9 + protected function buildUserInformationDictionary( 10 + PhabricatorUser $user, 11 + $with_email = false, 12 + $with_availability = false) { 10 13 11 14 $roles = array(); 12 15 if ($user->getIsDisabled()) { ··· 40 43 'phid' => $user->getPHID(), 41 44 'userName' => $user->getUserName(), 42 45 'realName' => $user->getRealName(), 43 - 'primaryEmail' => $email, 44 46 'image' => $user->getProfileImageURI(), 45 47 'uri' => PhabricatorEnv::getURI('/p/'.$user->getUsername().'/'), 46 48 'roles' => $roles, 47 49 ); 48 50 49 - // TODO: Modernize this once we have a more long-term view of what the 50 - // data looks like. 51 - $until = $user->getAwayUntil(); 52 - if ($until) { 53 - $return['currentStatus'] = 'away'; 54 - $return['currentStatusUntil'] = $until; 51 + if ($with_email) { 52 + $return['primaryEmail'] = $email; 53 + } 54 + 55 + if ($with_availability) { 56 + // TODO: Modernize this once we have a more long-term view of what the 57 + // data looks like. 58 + $until = $user->getAwayUntil(); 59 + if ($until) { 60 + $return['currentStatus'] = 'away'; 61 + $return['currentStatusUntil'] = $until; 62 + } 55 63 } 56 64 57 65 return $return;
+4 -1
src/applications/people/conduit/UserQueryConduitAPIMethod.php
··· 71 71 72 72 $results = array(); 73 73 foreach ($users as $user) { 74 - $results[] = $this->buildUserInformationDictionary($user); 74 + $results[] = $this->buildUserInformationDictionary( 75 + $user, 76 + $with_email = false, 77 + $with_availability = true); 75 78 } 76 79 return $results; 77 80 }
+4 -1
src/applications/people/conduit/UserWhoAmIConduitAPIMethod.php
··· 29 29 ->withPHIDs(array($request->getUser()->getPHID())) 30 30 ->executeOne(); 31 31 32 - return $this->buildUserInformationDictionary($person); 32 + return $this->buildUserInformationDictionary( 33 + $person, 34 + $with_email = true, 35 + $with_availability = false); 33 36 } 34 37 35 38 }