1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-22 21:40:55 +01:00

Restore profile links to OAuth resources.

Summary:

Test Plan:

Reviewers:

CC:
This commit is contained in:
epriestley 2011-02-22 11:06:37 -08:00
parent 063269a00a
commit d0ea1f1c7b
3 changed files with 36 additions and 9 deletions

View file

@ -53,14 +53,34 @@ class PhabricatorPeopleProfileController extends PhabricatorPeopleController {
'Edit Profile'); 'Edit Profile');
} }
$fbuid = null; // TODO: pull from OAuth stuff $oauths = id(new PhabricatorUserOAuthInfo())->loadAllWhere(
if ($fbuid) { '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( $links[] = phutil_render_tag(
'a', 'a',
array( array(
'href' => 'http://www.facebook.com/profile.php?id='.$fbuid, 'href' => $href,
), ),
'Facebook Profile'); phutil_escape_html($name));
}
} }
foreach ($links as $k => $link) { foreach ($links as $k => $link) {

View file

@ -7,11 +7,13 @@
phutil_require_module('phabricator', 'aphront/response/404'); 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/differential/parser/markup');
phutil_require_module('phabricator', 'applications/files/uri'); phutil_require_module('phabricator', 'applications/files/uri');
phutil_require_module('phabricator', 'applications/people/controller/base'); phutil_require_module('phabricator', 'applications/people/controller/base');
phutil_require_module('phabricator', 'applications/people/storage/profile'); phutil_require_module('phabricator', 'applications/people/storage/profile');
phutil_require_module('phabricator', 'applications/people/storage/user'); 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', 'infrastructure/celerity/api');
phutil_require_module('phabricator', 'view/utils'); phutil_require_module('phabricator', 'view/utils');

View file

@ -156,7 +156,12 @@ class PhabricatorStandardPageView extends AphrontPageView {
$user = $request->getUser(); $user = $request->getUser();
if ($user->getPHID()) { if ($user->getPHID()) {
$login_stuff = $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())).
' · '. ' · '.
'<a href="/settings/">Settings</a>'. '<a href="/settings/">Settings</a>'.
' &middot; '. ' &middot; '.