Page MenuHomePhabricator

D20798.id49591.diff
No OneTemporary

D20798.id49591.diff

diff --git a/src/applications/herald/controller/HeraldRuleController.php b/src/applications/herald/controller/HeraldRuleController.php
--- a/src/applications/herald/controller/HeraldRuleController.php
+++ b/src/applications/herald/controller/HeraldRuleController.php
@@ -404,8 +404,8 @@
HeraldAdapter $adapter) {
$all_rules = $this->loadRulesThisRuleMayDependUpon($rule);
- $all_rules = mpull($all_rules, 'getName', 'getPHID');
- asort($all_rules);
+ $all_rules = msortv($all_rules, 'getEditorSortVector');
+ $all_rules = mpull($all_rules, 'getEditorDisplayName', 'getPHID');
$all_fields = $adapter->getFieldNameMap();
$all_conditions = $adapter->getConditionNameMap();
@@ -674,15 +674,6 @@
->execute();
}
- // mark disabled rules as disabled since they are not useful as such;
- // don't filter though to keep edit cases sane / expected
- foreach ($all_rules as $current_rule) {
- if ($current_rule->getIsDisabled()) {
- $current_rule->makeEphemeral();
- $current_rule->setName($rule->getName().' '.pht('(Disabled)'));
- }
- }
-
// A rule can not depend upon itself.
unset($all_rules[$rule->getID()]);
diff --git a/src/applications/herald/storage/HeraldRule.php b/src/applications/herald/storage/HeraldRule.php
--- a/src/applications/herald/storage/HeraldRule.php
+++ b/src/applications/herald/storage/HeraldRule.php
@@ -259,6 +259,22 @@
return '/'.$this->getMonogram();
}
+ public function getEditorSortVector() {
+ return id(new PhutilSortVector())
+ ->addInt($this->getIsDisabled() ? 1 : 0)
+ ->addString($this->getName());
+ }
+
+ public function getEditorDisplayName() {
+ $name = pht('%s %s', $this->getMonogram(), $this->getName());
+
+ if ($this->getIsDisabled()) {
+ $name = pht('%s (Disabled)', $name);
+ }
+
+ return $name;
+ }
+
/* -( Repetition Policies )------------------------------------------------ */

File Metadata

Mime Type
text/plain
Expires
Sun, Mar 9, 2:43 PM (12 h, 35 m ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7385230
Default Alt Text
D20798.id49591.diff (1 KB)

Event Timeline