Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15335256
D20798.id49591.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D20798.id49591.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D20798: Improve rendering of Herald rules in "Another Herald rule..." field
Attached
Detach File
Event Timeline
Log In to Comment