I've noticed that PhabricatorEventType::TYPE_MANIPHEST_WILLEDITTASK event is not triggered neither when creating new task via email nor when editing existing task by reply via email (e.g. when using commands like !assign, !priority). Same applies to PhabricatorEventType::TYPE_MANIPHEST_DIDEDITTASK.
We have some custom logic in our PhabricatorEventType::TYPE_MANIPHEST_WILLEDITTASK listener and we would like it to apply for tasks that are created/edited via email too.
Since event is fired when task is edited via Web and via Conduit I think it's not unreasonable to have it when editing via Email as well.
AFAICT actual saving called from PhabricatorApplicationTransactionReplyHandler::receiveEmail() which doesn't know anything about Maniphest events and I didn't see any obvious place to hook in from Maniphest application between building transactions and applyTransactions().
Maybe adding empty say PhabricatorApplicationTransactionReplyHandler::willApplyTransactions() method that ManiphestReplyHandler could override and fire WILLEDITTASK event would be a solution? Of course then we would also need didApplyTransactions() to fire DIDEDITTASK...