mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-18 12:52:42 +01:00
Start actually showing the phurl urls to users
Summary: Fixes T10679. Added a 'short url' field to the phurl link page and changed the "view url" button to link to the shortened version Test Plan: Create a phurl link (or navigate to an existing one) and note that there is now a field for "Short URL". Also verified that the "Visit URL" button in the top right still works as intended Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley, yelirekim Maniphest Tasks: T10679 Differential Revision: https://secure.phabricator.com/D16473
This commit is contained in:
parent
f5537fdff6
commit
7ce5853936
2 changed files with 15 additions and 3 deletions
|
@ -86,7 +86,7 @@ final class PhabricatorPhurlURLViewController
|
|||
->setTag('a')
|
||||
->setText(pht('Visit URL'))
|
||||
->setIcon('fa-external-link')
|
||||
->setHref("u/{$id}")
|
||||
->setHref($url->getRedirectURI())
|
||||
->setDisabled(!$url->isValid());
|
||||
|
||||
$header = id(new PHUIHeaderView())
|
||||
|
@ -129,6 +129,10 @@ final class PhabricatorPhurlURLViewController
|
|||
$properties = id(new PHUIPropertyListView())
|
||||
->setUser($viewer);
|
||||
|
||||
$properties->addProperty(
|
||||
pht('Short URL'),
|
||||
$url->getRedirectURI());
|
||||
|
||||
$properties->addProperty(
|
||||
pht('Original URL'),
|
||||
$url->getLongURL());
|
||||
|
|
|
@ -99,10 +99,18 @@ final class PhabricatorPhurlURL extends PhabricatorPhurlDAO
|
|||
|
||||
public function getRedirectURI() {
|
||||
if (strlen($this->getAlias())) {
|
||||
return '/u/'.$this->getAlias();
|
||||
$path = '/u/'.$this->getAlias();
|
||||
} else {
|
||||
return '/u/'.$this->getID();
|
||||
$path = '/u/'.$this->getID();
|
||||
}
|
||||
$short_domain = PhabricatorEnv::getEnvConfig('phurl.short-uri');
|
||||
if (!$short_domain) {
|
||||
return $path;
|
||||
}
|
||||
|
||||
$uri = new PhutilURI($short_domain);
|
||||
$uri->setPath($path);
|
||||
return (string)$uri;
|
||||
}
|
||||
|
||||
/* -( PhabricatorPolicyInterface )----------------------------------------- */
|
||||
|
|
Loading…
Reference in a new issue