@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Improve rendering of Herald rules in "Another Herald rule..." field

Summary:
Fixes T9136.

- Fix a bug where the name is rendered improperly.
- Put disabled rules at the bottom.
- Always show the rule monogram so you can distingiush between rules with the same name.

Test Plan: {F6849915}

Maniphest Tasks: T9136

Differential Revision: https://secure.phabricator.com/D20798

+18 -11
+2 -11
src/applications/herald/controller/HeraldRuleController.php
··· 404 404 HeraldAdapter $adapter) { 405 405 406 406 $all_rules = $this->loadRulesThisRuleMayDependUpon($rule); 407 - $all_rules = mpull($all_rules, 'getName', 'getPHID'); 408 - asort($all_rules); 407 + $all_rules = msortv($all_rules, 'getEditorSortVector'); 408 + $all_rules = mpull($all_rules, 'getEditorDisplayName', 'getPHID'); 409 409 410 410 $all_fields = $adapter->getFieldNameMap(); 411 411 $all_conditions = $adapter->getConditionNameMap(); ··· 672 672 ->withContentTypes(array($rule->getContentType())) 673 673 ->withAuthorPHIDs(array($rule->getAuthorPHID())) 674 674 ->execute(); 675 - } 676 - 677 - // mark disabled rules as disabled since they are not useful as such; 678 - // don't filter though to keep edit cases sane / expected 679 - foreach ($all_rules as $current_rule) { 680 - if ($current_rule->getIsDisabled()) { 681 - $current_rule->makeEphemeral(); 682 - $current_rule->setName($rule->getName().' '.pht('(Disabled)')); 683 - } 684 675 } 685 676 686 677 // A rule can not depend upon itself.
+16
src/applications/herald/storage/HeraldRule.php
··· 259 259 return '/'.$this->getMonogram(); 260 260 } 261 261 262 + public function getEditorSortVector() { 263 + return id(new PhutilSortVector()) 264 + ->addInt($this->getIsDisabled() ? 1 : 0) 265 + ->addString($this->getName()); 266 + } 267 + 268 + public function getEditorDisplayName() { 269 + $name = pht('%s %s', $this->getMonogram(), $this->getName()); 270 + 271 + if ($this->getIsDisabled()) { 272 + $name = pht('%s (Disabled)', $name); 273 + } 274 + 275 + return $name; 276 + } 277 + 262 278 263 279 /* -( Repetition Policies )------------------------------------------------ */ 264 280