1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-04 12:42:43 +01:00
phorge-phorge/src/applications/herald/controller
epriestley f7f3dd5b20 Don't run Herald build and mail rules when they don't make sense
Summary:
Ref T2543. Fixes T10109.

Currently, Herald only runs in Differential when a change updates the diff. This is partly for historical reasons, and partly because we don't want to restart builds every time someone makes a comment. However, this behavior is inconsistent with other applications (which always trigger on any change), and occasionally confusing to users (in T10109, for example) or otherwise undesirable.

A similar issue is that T2543 has introduced a "Draft" state, where revisions don't send normal mail until builds finish. This interacts poorly with "Send me an email" rules (which shouldn't do anything here) and particularly with "Send me an email + only run these actions the first time the rule matches", since that might have an effect like "do nothing when the revision is created, then never anything again since you already did nothing once".

To navigate both of these issues, let objects tell Herald that certain actions (like mail or builds) are currently forbidden. If a rule uses a field or action which is currently forbidden, the whole rule automatically fails before it executes, but doesn't count toward "only the first time" as far as Herald's tracking of rule execution is concerned.

Then, forbid mail for draft revisions, and forbid builds for revisions which didn't just get updated. Forbidding mail fixes the issues with "Send me an email" that were created by the introduction of the draft state.

Finally, make Herald run on every revision update, not just substantive updates to the diff. This resolves T10109.

Test Plan:
Created revisions via the draft -> submit workflow, saw different transcripts. Here's a mail action being forbidden for a draft:

{F5237324}

Here's a build action being forbidden for a "mundane" update:

{F5237326}

Reviewers: amckinley

Reviewed By: amckinley

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T10109, T2543

Differential Revision: https://secure.phabricator.com/D18731
2017-10-27 08:44:12 -07:00
..
HeraldController.php Fix errors found by PHPStan 2017-02-17 10:10:15 +00:00
HeraldDisableController.php Use monograms for Herald URIs 2015-11-13 07:07:00 +11:00
HeraldNewController.php Update herald edit for new UI 2017-09-07 12:46:32 -07:00
HeraldRuleController.php Update passphrase edit UI 2017-09-07 14:13:40 -07:00
HeraldRuleListController.php Update Herald for handleRequest 2015-08-01 15:41:36 -07:00
HeraldRuleViewController.php Let everyone view Herald rules 2016-08-10 08:52:36 -07:00
HeraldTestConsoleController.php Fix a Herald issue where testing commits against rules with revision-related conditions would fail 2016-09-08 17:16:40 -07:00
HeraldTranscriptController.php Don't run Herald build and mail rules when they don't make sense 2017-10-27 08:44:12 -07:00
HeraldTranscriptListController.php Modernize Herald 2015-11-30 07:11:52 -08:00