1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-15 03:12:41 +01:00
phorge-phorge/src/applications/metamta/herald/PhabricatorMailOutboundRoutingHeraldAction.php
epriestley 7a1bbe6634 Add basic support for Herald outbound rules
Summary: Ref T5791. This is still very basic (no global actions, no support for matching headers/bodies/recipients/etc) but gets the core in.

Test Plan:
{F715209}

{F715211}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T5791

Differential Revision: https://secure.phabricator.com/D13897
2015-08-15 10:54:33 -07:00

46 lines
1 KiB
PHP

<?php
abstract class PhabricatorMailOutboundRoutingHeraldAction
extends HeraldAction {
const DO_ROUTE = 'do.route';
public function supportsObject($object) {
return ($object instanceof PhabricatorMetaMTAMail);
}
public function getActionGroupKey() {
return HeraldApplicationActionGroup::ACTIONGROUPKEY;
}
protected function applyRouting(HeraldRule $rule, $route, $phids) {
$adapter = $this->getAdapter();
$mail = $adapter->getObject();
$mail->addRoutingRule($route, $phids, $rule->getPHID());
$this->logEffect(
self::DO_ROUTE,
array(
'route' => $route,
'phids' => $phids,
));
}
protected function getActionEffectMap() {
return array(
self::DO_ROUTE => array(
'icon' => 'fa-arrow-right',
'color' => 'green',
'name' => pht('Routed Message'),
),
);
}
protected function renderActionEffectDescription($type, $data) {
switch ($type) {
case self::DO_ROUTE:
return pht('Routed mail.');
}
}
}