1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-18 11:30:55 +01:00
phorge-phorge/src/applications/metamta
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
..
action When we fail to process mail, tell the user about it 2014-04-03 18:43:18 -07:00
adapter Explicitly quote "From" name part when submitting mail to the Mailgun API 2017-05-04 17:03:26 -07:00
application Move FontIcon calls to Icon 2016-01-28 08:48:45 -08:00
applicationpanel Separate button CSS classes 2017-06-05 20:14:34 +00:00
command Use PhutilClassMapQuery 2015-07-07 22:51:57 +10:00
constants Add basic support for Herald outbound rules 2015-08-15 10:54:33 -07:00
contentsource Modularize content sources 2016-03-26 11:59:45 -07:00
controller Convert all remaining old tabs to new PHUITabGroupViews 2016-06-30 18:50:09 -07:00
edge MetaMTA - more progress towards a mail application 2015-06-23 11:37:14 -07:00
editor Use ApplicationTransactions in ApplicationEmail 2015-06-11 10:15:49 -07:00
exception Apply some autofix linter rules 2014-09-10 06:55:05 +10:00
garbagecollector Provide bin/garbage for interacting with garbage collection 2015-10-02 09:17:24 -07:00
herald Don't run Herald build and mail rules when they don't make sense 2017-10-27 08:44:12 -07:00
management Fix spelling 2017-10-09 10:48:04 -07:00
parser Extend from Phobject 2015-06-15 18:02:27 +10:00
phid Mark PhabricatorPHIDType::getPHIDTypeApplicationClass() as abstract 2015-11-03 06:47:12 +11:00
query Reduce application search engine results list for Dashboards 2017-02-22 12:42:43 -08:00
receiver Fix spelling 2017-10-09 10:48:04 -07:00
replyhandler Make caches misses throw by default intead of inline-generating 2016-06-05 08:51:54 -07:00
storage Queue a worker task to send mail only after committing the mail transaction 2017-06-14 12:27:00 -07:00
typeahead Make packages mailable and subscribable 2016-05-13 17:18:57 -07:00
view Highlight inline diff context in HTML mail 2016-05-05 11:13:27 -07:00
PhabricatorMetaMTAWorker.php Send permanent dameon failures to the log, even when not running in verbose mode 2017-06-08 15:26:19 -07:00