Attach HeraldRules to HeraldEffects
Summary: Ref T7731. For no particular reason, we currently put `ruleID` and `rulePHID` on `HeraldEffect` objects. Pretty much all callers need the `HeraldRule` objects instead, and some go to great lengths to get them. Just attach the `Rule` objects. Test Plan: Will test thoroughly after next-ish changeset. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T7731 Differential Revision: https://secure.phabricator.com/D12269
This commit is contained in:
@@ -337,22 +337,16 @@ final class DiffusionCommitHookEngine extends Phobject {
|
||||
}
|
||||
|
||||
if ($blocking_effect) {
|
||||
$rule = $blocking_effect->getRule();
|
||||
|
||||
$this->rejectCode = PhabricatorRepositoryPushLog::REJECT_HERALD;
|
||||
$this->rejectDetails = $blocking_effect->getRulePHID();
|
||||
$this->rejectDetails = $rule->getPHID();
|
||||
|
||||
$message = $blocking_effect->getTarget();
|
||||
if (!strlen($message)) {
|
||||
$message = pht('(None.)');
|
||||
}
|
||||
|
||||
$rules = mpull($rules, null, 'getID');
|
||||
$rule = idx($rules, $effect->getRuleID());
|
||||
if ($rule && strlen($rule->getName())) {
|
||||
$rule_name = $rule->getName();
|
||||
} else {
|
||||
$rule_name = pht('Unnamed Herald Rule');
|
||||
}
|
||||
|
||||
$blocked_ref_name = coalesce(
|
||||
$blocked_update->getRefName(),
|
||||
$blocked_update->getRefNewShort());
|
||||
@@ -364,9 +358,9 @@ final class DiffusionCommitHookEngine extends Phobject {
|
||||
"Change: %s\n".
|
||||
" Rule: %s\n".
|
||||
"Reason: %s",
|
||||
'H'.$blocking_effect->getRuleID(),
|
||||
$rule->getMonogram(),
|
||||
$blocked_name,
|
||||
$rule_name,
|
||||
$rule->getName(),
|
||||
$message));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user