@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.

Support "only the first time" in Maniphest

Summary:
Ref T4403. Implements "only the first time" for Maniphest rules, and fixes the trigger itself.

The trigger would never fire and block rules because it was comparing a string (like "first") to an int (like 0).

The "only" vs "every" stuff is contributed and I should have pushed back harder on this toInt / toString stuff. Maybe I'll just get rid of it; it purely causes confusion and problems.

Test Plan: Wrote an "only the first time" rule, ran it twice, it applied once.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T4403

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

+14 -3
+7
src/applications/herald/adapter/HeraldManiphestTaskAdapter.php
··· 19 19 'React to tasks being created or updated.'); 20 20 } 21 21 22 + public function getRepetitionOptions() { 23 + return array( 24 + HeraldRepetitionPolicyConfig::EVERY, 25 + HeraldRepetitionPolicyConfig::FIRST, 26 + ); 27 + } 28 + 22 29 public function supportsRuleType($rule_type) { 23 30 switch ($rule_type) { 24 31 case HeraldRuleTypeConfig::RULE_TYPE_GLOBAL:
+6 -2
src/applications/herald/engine/HeraldEngine.php
··· 61 61 $effects = array(); 62 62 foreach ($rules as $phid => $rule) { 63 63 $this->stack = array(); 64 + 65 + $policy_first = HeraldRepetitionPolicyConfig::FIRST; 66 + $policy_first_int = HeraldRepetitionPolicyConfig::toInt($policy_first); 67 + $is_first_only = ($rule->getRepetitionPolicy() == $policy_first_int); 68 + 64 69 try { 65 70 if (!$this->getDryRun() && 66 - ($rule->getRepetitionPolicy() == 67 - HeraldRepetitionPolicyConfig::FIRST) && 71 + $is_first_only && 68 72 $rule->getRuleApplied($object->getPHID())) { 69 73 // This is not a dry run, and this rule is only supposed to be 70 74 // applied a single time, and it's already been applied...
+1 -1
src/applications/herald/storage/HeraldRule.php
··· 17 17 protected $isDisabled = 0; 18 18 protected $triggerObjectPHID; 19 19 20 - protected $configVersion = 30; 20 + protected $configVersion = 31; 21 21 22 22 // phids for which this rule has been applied 23 23 private $ruleApplied = self::ATTACHABLE;