mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 12:00:55 +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:
parent
a1737ef9c7
commit
feca8fbdec
6 changed files with 13 additions and 13 deletions
|
@ -47,10 +47,10 @@ final class PhabricatorHeraldApplication extends PhabricatorApplication {
|
||||||
|
|
||||||
public function getRoutes() {
|
public function getRoutes() {
|
||||||
return array(
|
return array(
|
||||||
|
'/H(?P<id>[1-9]\d*)' => 'HeraldRuleViewController',
|
||||||
'/herald/' => array(
|
'/herald/' => array(
|
||||||
'(?:query/(?P<queryKey>[^/]+)/)?' => 'HeraldRuleListController',
|
'(?:query/(?P<queryKey>[^/]+)/)?' => 'HeraldRuleListController',
|
||||||
'new/' => 'HeraldNewController',
|
'new/' => 'HeraldNewController',
|
||||||
'rule/(?P<id>[1-9]\d*)/' => 'HeraldRuleViewController',
|
|
||||||
'edit/(?:(?P<id>[1-9]\d*)/)?' => 'HeraldRuleController',
|
'edit/(?:(?P<id>[1-9]\d*)/)?' => 'HeraldRuleController',
|
||||||
'disable/(?P<id>[1-9]\d*)/(?P<action>\w+)/'
|
'disable/(?P<id>[1-9]\d*)/(?P<action>\w+)/'
|
||||||
=> 'HeraldDisableController',
|
=> 'HeraldDisableController',
|
||||||
|
|
|
@ -25,7 +25,7 @@ final class HeraldDisableController extends HeraldController {
|
||||||
HeraldManageGlobalRulesCapability::CAPABILITY);
|
HeraldManageGlobalRulesCapability::CAPABILITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
$view_uri = $this->getApplicationURI("rule/{$id}/");
|
$view_uri = '/'.$rule->getMonogram();
|
||||||
|
|
||||||
$is_disable = ($action === 'disable');
|
$is_disable = ($action === 'disable');
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ final class HeraldRuleController extends HeraldController {
|
||||||
if (!$rule) {
|
if (!$rule) {
|
||||||
return new Aphront404Response();
|
return new Aphront404Response();
|
||||||
}
|
}
|
||||||
$cancel_uri = $this->getApplicationURI("rule/{$id}/");
|
$cancel_uri = '/'.$rule->getMonogram();
|
||||||
} else {
|
} else {
|
||||||
$new_uri = $this->getApplicationURI('new/');
|
$new_uri = $this->getApplicationURI('new/');
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ final class HeraldRuleController extends HeraldController {
|
||||||
list($e_name, $errors) = $this->saveRule($adapter, $rule, $request);
|
list($e_name, $errors) = $this->saveRule($adapter, $rule, $request);
|
||||||
if (!$errors) {
|
if (!$errors) {
|
||||||
$id = $rule->getID();
|
$id = $rule->getID();
|
||||||
$uri = $this->getApplicationURI("rule/{$id}/");
|
$uri = '/'.$rule->getMonogram();
|
||||||
return id(new AphrontRedirectResponse())->setURI($uri);
|
return id(new AphrontRedirectResponse())->setURI($uri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ final class HeraldRuleViewController extends HeraldController {
|
||||||
$view = id(new PhabricatorActionListView())
|
$view = id(new PhabricatorActionListView())
|
||||||
->setUser($viewer)
|
->setUser($viewer)
|
||||||
->setObject($rule)
|
->setObject($rule)
|
||||||
->setObjectURI($this->getApplicationURI("rule/{$id}/"));
|
->setObjectURI('/'.$rule->getMonogram());
|
||||||
|
|
||||||
$can_edit = PhabricatorPolicyFilter::hasCapability(
|
$can_edit = PhabricatorPolicyFilter::hasCapability(
|
||||||
$viewer,
|
$viewer,
|
||||||
|
|
|
@ -32,12 +32,12 @@ final class HeraldRulePHIDType extends PhabricatorPHIDType {
|
||||||
foreach ($handles as $phid => $handle) {
|
foreach ($handles as $phid => $handle) {
|
||||||
$rule = $objects[$phid];
|
$rule = $objects[$phid];
|
||||||
|
|
||||||
$id = $rule->getID();
|
$monogram = $rule->getMonogram();
|
||||||
$name = $rule->getName();
|
$name = $rule->getName();
|
||||||
|
|
||||||
$handle->setName("H{$id}");
|
$handle->setName($monogram);
|
||||||
$handle->setFullName("H{$id} {$name}");
|
$handle->setFullName("{$monogram} {$name}");
|
||||||
$handle->setURI("/herald/rule/{$id}/");
|
$handle->setURI("/{$monogram}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -173,12 +173,12 @@ final class HeraldRuleSearchEngine extends PhabricatorApplicationSearchEngine {
|
||||||
$list = id(new PHUIObjectItemListView())
|
$list = id(new PHUIObjectItemListView())
|
||||||
->setUser($viewer);
|
->setUser($viewer);
|
||||||
foreach ($rules as $rule) {
|
foreach ($rules as $rule) {
|
||||||
$id = $rule->getID();
|
$monogram = $rule->getMonogram();
|
||||||
|
|
||||||
$item = id(new PHUIObjectItemView())
|
$item = id(new PHUIObjectItemView())
|
||||||
->setObjectName("H{$id}")
|
->setObjectName($monogram)
|
||||||
->setHeader($rule->getName())
|
->setHeader($rule->getName())
|
||||||
->setHref($this->getApplicationURI("rule/{$id}/"));
|
->setHref("/{$monogram}");
|
||||||
|
|
||||||
if ($rule->isPersonalRule()) {
|
if ($rule->isPersonalRule()) {
|
||||||
$item->addIcon('fa-user', pht('Personal Rule'));
|
$item->addIcon('fa-user', pht('Personal Rule'));
|
||||||
|
|
Loading…
Reference in a new issue