mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 13:30:55 +01:00
Restore profile links to OAuth resources.
Summary: Test Plan: Reviewers: CC:
This commit is contained in:
parent
063269a00a
commit
d0ea1f1c7b
3 changed files with 36 additions and 9 deletions
|
@ -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',
|
||||||
$links[] = phutil_render_tag(
|
$user->getID());
|
||||||
'a',
|
$oauths = mpull($oauths, null, 'getOAuthProvider');
|
||||||
array(
|
|
||||||
'href' => 'http://www.facebook.com/profile.php?id='.$fbuid,
|
$providers = PhabricatorOAuthProvider::getAllProviders();
|
||||||
),
|
foreach ($providers as $provider) {
|
||||||
'Facebook Profile');
|
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) {
|
foreach ($links as $k => $link) {
|
||||||
|
|
|
@ -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');
|
||||||
|
|
||||||
|
|
|
@ -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>'.
|
||||||
' · '.
|
' · '.
|
||||||
|
|
Loading…
Reference in a new issue