diff --git a/src/applications/people/controller/profile/PhabricatorPeopleProfileController.php b/src/applications/people/controller/profile/PhabricatorPeopleProfileController.php index eec1676c63..c27efd9ba7 100644 --- a/src/applications/people/controller/profile/PhabricatorPeopleProfileController.php +++ b/src/applications/people/controller/profile/PhabricatorPeopleProfileController.php @@ -53,14 +53,34 @@ class PhabricatorPeopleProfileController extends PhabricatorPeopleController { 'Edit Profile'); } - $fbuid = null; // TODO: pull from OAuth stuff - if ($fbuid) { - $links[] = phutil_render_tag( - 'a', - array( - 'href' => 'http://www.facebook.com/profile.php?id='.$fbuid, - ), - 'Facebook Profile'); + $oauths = id(new PhabricatorUserOAuthInfo())->loadAllWhere( + 'userID = %d', + $user->getID()); + $oauths = mpull($oauths, null, 'getOAuthProvider'); + + $providers = PhabricatorOAuthProvider::getAllProviders(); + foreach ($providers as $provider) { + if (!$provider->isProviderEnabled()) { + continue; + } + + $provider_key = $provider->getProviderKey(); + + if (!isset($oauths[$provider_key])) { + continue; + } + + $name = $provider->getProviderName().' Profile'; + $href = $oauths[$provider_key]->getAccountURI(); + + if ($href) { + $links[] = phutil_render_tag( + 'a', + array( + 'href' => $href, + ), + phutil_escape_html($name)); + } } foreach ($links as $k => $link) { diff --git a/src/applications/people/controller/profile/__init__.php b/src/applications/people/controller/profile/__init__.php index 6d2fbb0974..e336f1b0c1 100644 --- a/src/applications/people/controller/profile/__init__.php +++ b/src/applications/people/controller/profile/__init__.php @@ -7,11 +7,13 @@ phutil_require_module('phabricator', 'aphront/response/404'); +phutil_require_module('phabricator', 'applications/auth/oauth/provider/base'); phutil_require_module('phabricator', 'applications/differential/parser/markup'); phutil_require_module('phabricator', 'applications/files/uri'); phutil_require_module('phabricator', 'applications/people/controller/base'); phutil_require_module('phabricator', 'applications/people/storage/profile'); phutil_require_module('phabricator', 'applications/people/storage/user'); +phutil_require_module('phabricator', 'applications/people/storage/useroauthinfo'); phutil_require_module('phabricator', 'infrastructure/celerity/api'); phutil_require_module('phabricator', 'view/utils'); diff --git a/src/view/page/standard/PhabricatorStandardPageView.php b/src/view/page/standard/PhabricatorStandardPageView.php index 3077055124..1a5655feed 100755 --- a/src/view/page/standard/PhabricatorStandardPageView.php +++ b/src/view/page/standard/PhabricatorStandardPageView.php @@ -156,7 +156,12 @@ class PhabricatorStandardPageView extends AphrontPageView { $user = $request->getUser(); if ($user->getPHID()) { $login_stuff = - 'Logged in as '.phutil_escape_html($user->getUsername()). + 'Logged in as '.phutil_render_tag( + 'a', + array( + 'href' => '/p/'.$user->getUsername().'/', + ), + phutil_escape_html($user->getUsername())). ' · '. 'Settings'. ' · '.