1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-18 21:02:41 +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:
Josh Cox 2016-08-29 20:41:14 -04:00
parent f5537fdff6
commit 7ce5853936
2 changed files with 15 additions and 3 deletions

View file

@ -86,7 +86,7 @@ final class PhabricatorPhurlURLViewController
->setTag('a') ->setTag('a')
->setText(pht('Visit URL')) ->setText(pht('Visit URL'))
->setIcon('fa-external-link') ->setIcon('fa-external-link')
->setHref("u/{$id}") ->setHref($url->getRedirectURI())
->setDisabled(!$url->isValid()); ->setDisabled(!$url->isValid());
$header = id(new PHUIHeaderView()) $header = id(new PHUIHeaderView())
@ -129,6 +129,10 @@ final class PhabricatorPhurlURLViewController
$properties = id(new PHUIPropertyListView()) $properties = id(new PHUIPropertyListView())
->setUser($viewer); ->setUser($viewer);
$properties->addProperty(
pht('Short URL'),
$url->getRedirectURI());
$properties->addProperty( $properties->addProperty(
pht('Original URL'), pht('Original URL'),
$url->getLongURL()); $url->getLongURL());

View file

@ -99,10 +99,18 @@ final class PhabricatorPhurlURL extends PhabricatorPhurlDAO
public function getRedirectURI() { public function getRedirectURI() {
if (strlen($this->getAlias())) { if (strlen($this->getAlias())) {
return '/u/'.$this->getAlias(); $path = '/u/'.$this->getAlias();
} else { } 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 )----------------------------------------- */ /* -( PhabricatorPolicyInterface )----------------------------------------- */