1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-04-02 07:28:17 +02:00
phorge-phorge/src/applications/herald/application/PhabricatorApplicationHerald.php
epriestley 953ff197bf Allow Herald rules to be disabled, instead of deleted
Summary:
Ref T603. Ref T1279. Further improves transaction and policy support for Herald.

  - Instead of deleting rules (which wipes out history and can't be undone) allow them to be disabled.
  - Track disables with transactions.
  - Gate disables with policy controls.
  - Show policy and status information in the headers.
  - Show transaction history on rule detail screens.
  - Remove the delete controller.
  - Support disabled queries in the ApplicationSearch.

Test Plan:
  - Enabled and disabled rules.
  - Searched for enabled/disabled rules.
  - Verified disabled rules don't activate.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T1279, T603

Differential Revision: https://secure.phabricator.com/D7247
2013-10-06 17:10:29 -07:00

69 lines
1.9 KiB
PHP

<?php
final class PhabricatorApplicationHerald extends PhabricatorApplication {
const CAN_CREATE_RULE = 'herald.create';
const CAN_CREATE_GLOBAL_RULE = 'herald.global';
public function getBaseURI() {
return '/herald/';
}
public function getIconName() {
return 'herald';
}
public function getShortDescription() {
return pht('Create Notification Rules');
}
public function getTitleGlyph() {
return "\xE2\x98\xBF";
}
public function getHelpURI() {
return PhabricatorEnv::getDoclink('article/Herald_User_Guide.html');
}
public function getFlavorText() {
return pht('Watch for danger!');
}
public function getApplicationGroup() {
return self::GROUP_ORGANIZATION;
}
public function getRoutes() {
return array(
'/herald/' => array(
'(?:query/(?P<queryKey>[^/]+)/)?' => 'HeraldRuleListController',
'new/(?:(?P<type>[^/]+)/(?:(?P<rule_type>[^/]+)/)?)?'
=> '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',
'history/(?:(?P<id>[1-9]\d*)/)?' => 'HeraldRuleEditHistoryController',
'test/' => 'HeraldTestConsoleController',
'transcript/' => 'HeraldTranscriptListController',
'transcript/(?P<id>[1-9]\d*)/(?:(?P<filter>\w+)/)?'
=> 'HeraldTranscriptController',
),
);
}
protected function getCustomCapabilities() {
return array(
self::CAN_CREATE_RULE => array(
'label' => pht('Can Create Rules'),
),
self::CAN_CREATE_GLOBAL_RULE => array(
'label' => pht('Can Create Global Rules'),
'caption' => pht('Global rules can bypass access controls.'),
'default' => PhabricatorPolicies::POLICY_ADMIN,
),
);
}
}