1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-22 05:20:56 +01:00

Use monograms for Herald URIs

Summary: I think `HeraldRule`s are the only objects which have monograms but are not accesible via `/{$monogram}`. This diff changes the `/herald/rule/{$id}` URI to `/{$monogram}`.

Test Plan: Clicked a bunch of links in Herald to ensure there were no dead links.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D14469
This commit is contained in:
Joshua Spence 2015-11-13 07:06:59 +11:00
parent a1737ef9c7
commit feca8fbdec
6 changed files with 13 additions and 13 deletions

View file

@ -47,10 +47,10 @@ final class PhabricatorHeraldApplication extends PhabricatorApplication {
public function getRoutes() {
return array(
'/H(?P<id>[1-9]\d*)' => 'HeraldRuleViewController',
'/herald/' => array(
'(?:query/(?P<queryKey>[^/]+)/)?' => 'HeraldRuleListController',
'new/' => 'HeraldNewController',
'rule/(?P<id>[1-9]\d*)/' => 'HeraldRuleViewController',
'edit/(?:(?P<id>[1-9]\d*)/)?' => 'HeraldRuleController',
'disable/(?P<id>[1-9]\d*)/(?P<action>\w+)/'
=> 'HeraldDisableController',

View file

@ -25,7 +25,7 @@ final class HeraldDisableController extends HeraldController {
HeraldManageGlobalRulesCapability::CAPABILITY);
}
$view_uri = $this->getApplicationURI("rule/{$id}/");
$view_uri = '/'.$rule->getMonogram();
$is_disable = ($action === 'disable');

View file

@ -22,7 +22,7 @@ final class HeraldRuleController extends HeraldController {
if (!$rule) {
return new Aphront404Response();
}
$cancel_uri = $this->getApplicationURI("rule/{$id}/");
$cancel_uri = '/'.$rule->getMonogram();
} else {
$new_uri = $this->getApplicationURI('new/');
@ -128,7 +128,7 @@ final class HeraldRuleController extends HeraldController {
list($e_name, $errors) = $this->saveRule($adapter, $rule, $request);
if (!$errors) {
$id = $rule->getID();
$uri = $this->getApplicationURI("rule/{$id}/");
$uri = '/'.$rule->getMonogram();
return id(new AphrontRedirectResponse())->setURI($uri);
}
}

View file

@ -67,7 +67,7 @@ final class HeraldRuleViewController extends HeraldController {
$view = id(new PhabricatorActionListView())
->setUser($viewer)
->setObject($rule)
->setObjectURI($this->getApplicationURI("rule/{$id}/"));
->setObjectURI('/'.$rule->getMonogram());
$can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer,

View file

@ -32,12 +32,12 @@ final class HeraldRulePHIDType extends PhabricatorPHIDType {
foreach ($handles as $phid => $handle) {
$rule = $objects[$phid];
$id = $rule->getID();
$name = $rule->getName();
$monogram = $rule->getMonogram();
$name = $rule->getName();
$handle->setName("H{$id}");
$handle->setFullName("H{$id} {$name}");
$handle->setURI("/herald/rule/{$id}/");
$handle->setName($monogram);
$handle->setFullName("{$monogram} {$name}");
$handle->setURI("/{$monogram}");
}
}

View file

@ -173,12 +173,12 @@ final class HeraldRuleSearchEngine extends PhabricatorApplicationSearchEngine {
$list = id(new PHUIObjectItemListView())
->setUser($viewer);
foreach ($rules as $rule) {
$id = $rule->getID();
$monogram = $rule->getMonogram();
$item = id(new PHUIObjectItemView())
->setObjectName("H{$id}")
->setObjectName($monogram)
->setHeader($rule->getName())
->setHref($this->getApplicationURI("rule/{$id}/"));
->setHref("/{$monogram}");
if ($rule->isPersonalRule()) {
$item->addIcon('fa-user', pht('Personal Rule'));