mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 12:00:55 +01:00
Correct "Manage Password" link in Quickling in Diffusion
Summary: Fixes T12080. This was missing a "/", but stop hard-coding these URIs. Test Plan: Clicked both links with Quickling as a logged-in and logged-out user, ended up in the right place. Reviewers: chad Reviewed By: chad Maniphest Tasks: T12080 Differential Revision: https://secure.phabricator.com/D17151
This commit is contained in:
parent
8a85ee7c15
commit
d4248d231b
3 changed files with 20 additions and 5 deletions
|
@ -35,6 +35,8 @@ final class DiffusionCloneURIView extends AphrontView {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render() {
|
public function render() {
|
||||||
|
$viewer = $this->getViewer();
|
||||||
|
|
||||||
require_celerity_resource('diffusion-icons-css');
|
require_celerity_resource('diffusion-icons-css');
|
||||||
|
|
||||||
Javelin::initBehavior('select-content');
|
Javelin::initBehavior('select-content');
|
||||||
|
@ -87,12 +89,18 @@ final class DiffusionCloneURIView extends AphrontView {
|
||||||
case PhabricatorRepositoryURI::IO_READWRITE:
|
case PhabricatorRepositoryURI::IO_READWRITE:
|
||||||
switch ($uri->getBuiltinProtocol()) {
|
switch ($uri->getBuiltinProtocol()) {
|
||||||
case PhabricatorRepositoryURI::BUILTIN_PROTOCOL_SSH:
|
case PhabricatorRepositoryURI::BUILTIN_PROTOCOL_SSH:
|
||||||
$auth_uri = '/settings/panel/ssh/';
|
$auth_uri = id(new PhabricatorSSHKeysSettingsPanel())
|
||||||
|
->setViewer($viewer)
|
||||||
|
->setUser($viewer)
|
||||||
|
->getPanelURI();
|
||||||
$auth_tip = pht('Manage SSH Keys');
|
$auth_tip = pht('Manage SSH Keys');
|
||||||
$auth_disabled = false;
|
$auth_disabled = false;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$auth_uri = '/settings/panel/vcspassword';
|
$auth_uri = id(new DiffusionSetPasswordSettingsPanel())
|
||||||
|
->setViewer($viewer)
|
||||||
|
->setUser($viewer)
|
||||||
|
->getPanelURI();
|
||||||
$auth_tip = pht('Manage Password');
|
$auth_tip = pht('Manage Password');
|
||||||
$auth_disabled = false;
|
$auth_disabled = false;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -32,7 +32,7 @@ final class PhabricatorSettingsMainController
|
||||||
|
|
||||||
// Redirect "/panel/XYZ/" to the viewer's personal settings panel. This
|
// Redirect "/panel/XYZ/" to the viewer's personal settings panel. This
|
||||||
// was the primary URI before global settings were introduced and allows
|
// was the primary URI before global settings were introduced and allows
|
||||||
// generation of viewer-agnostic URIs for email.
|
// generation of viewer-agnostic URIs for email and logged-out users.
|
||||||
$panel = $request->getURIData('panel');
|
$panel = $request->getURIData('panel');
|
||||||
if ($panel) {
|
if ($panel) {
|
||||||
$panel = phutil_escape_uri($panel);
|
$panel = phutil_escape_uri($panel);
|
||||||
|
|
|
@ -229,8 +229,15 @@ abstract class PhabricatorSettingsPanel extends Phobject {
|
||||||
|
|
||||||
$user = $this->getUser();
|
$user = $this->getUser();
|
||||||
if ($user) {
|
if ($user) {
|
||||||
|
if ($user->isLoggedIn()) {
|
||||||
$username = $user->getUsername();
|
$username = $user->getUsername();
|
||||||
return "/settings/user/{$username}/page/{$key}/{$path}";
|
return "/settings/user/{$username}/page/{$key}/{$path}";
|
||||||
|
} else {
|
||||||
|
// For logged-out users, we can't put their username in the URI. This
|
||||||
|
// page will prompt them to login, then redirect them to the correct
|
||||||
|
// location.
|
||||||
|
return "/settings/panel/{$key}/";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$builtin = $this->getPreferences()->getBuiltinKey();
|
$builtin = $this->getPreferences()->getBuiltinKey();
|
||||||
return "/settings/builtin/{$builtin}/page/{$key}/{$path}";
|
return "/settings/builtin/{$builtin}/page/{$key}/{$path}";
|
||||||
|
|
Loading…
Reference in a new issue