mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 12:00:55 +01:00
Add "Send an email" action to Herald for Maniphest
Summary: Fixes T4403. Supports the "send an email" action in Maniphest. Test Plan: Wrote a "email duck" rule, then commented on a task and saw "duck" get an email. Reviewers: btrahan Reviewed By: btrahan Subscribers: aran, epriestley Maniphest Tasks: T4403 Differential Revision: https://secure.phabricator.com/D8529
This commit is contained in:
parent
b168ee116b
commit
f54bc8ae58
3 changed files with 33 additions and 6 deletions
|
@ -1,14 +1,16 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @group herald
|
||||
*/
|
||||
final class HeraldManiphestTaskAdapter extends HeraldAdapter {
|
||||
|
||||
private $task;
|
||||
private $ccPHIDs = array();
|
||||
private $assignPHID;
|
||||
private $projectPHIDs = array();
|
||||
private $emailPHIDs = array();
|
||||
|
||||
public function getEmailPHIDs() {
|
||||
return $this->emailPHIDs;
|
||||
}
|
||||
|
||||
public function getAdapterApplicationClass() {
|
||||
return 'PhabricatorApplicationManiphest';
|
||||
|
@ -98,6 +100,7 @@ final class HeraldManiphestTaskAdapter extends HeraldAdapter {
|
|||
case HeraldRuleTypeConfig::RULE_TYPE_GLOBAL:
|
||||
return array(
|
||||
self::ACTION_ADD_CC,
|
||||
self::ACTION_EMAIL,
|
||||
self::ACTION_ASSIGN_TASK,
|
||||
self::ACTION_ADD_PROJECTS,
|
||||
self::ACTION_NOTHING,
|
||||
|
@ -105,6 +108,7 @@ final class HeraldManiphestTaskAdapter extends HeraldAdapter {
|
|||
case HeraldRuleTypeConfig::RULE_TYPE_PERSONAL:
|
||||
return array(
|
||||
self::ACTION_ADD_CC,
|
||||
self::ACTION_EMAIL,
|
||||
self::ACTION_FLAG,
|
||||
self::ACTION_ASSIGN_TASK,
|
||||
self::ACTION_NOTHING,
|
||||
|
@ -161,7 +165,16 @@ final class HeraldManiphestTaskAdapter extends HeraldAdapter {
|
|||
$result[] = new HeraldApplyTranscript(
|
||||
$effect,
|
||||
true,
|
||||
pht('Added address to cc list.'));
|
||||
pht('Added addresses to cc list.'));
|
||||
break;
|
||||
case self::ACTION_EMAIL:
|
||||
foreach ($effect->getTarget() as $phid) {
|
||||
$this->emailPHIDs[] = $phid;
|
||||
}
|
||||
$result[] = new HeraldApplyTranscript(
|
||||
$effect,
|
||||
true,
|
||||
pht('Added addresses to email list.'));
|
||||
break;
|
||||
case self::ACTION_FLAG:
|
||||
$result[] = parent::applyFlagEffect(
|
||||
|
|
|
@ -17,7 +17,7 @@ final class HeraldRule extends HeraldDAO
|
|||
protected $isDisabled = 0;
|
||||
protected $triggerObjectPHID;
|
||||
|
||||
protected $configVersion = 33;
|
||||
protected $configVersion = 34;
|
||||
|
||||
// phids for which this rule has been applied
|
||||
private $ruleApplied = self::ATTACHABLE;
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
final class ManiphestTransactionEditor
|
||||
extends PhabricatorApplicationTransactionEditor {
|
||||
|
||||
private $heraldEmailPHIDs = array();
|
||||
|
||||
public function getTransactionTypes() {
|
||||
$types = parent::getTransactionTypes();
|
||||
|
||||
|
@ -271,7 +273,17 @@ final class ManiphestTransactionEditor
|
|||
}
|
||||
|
||||
protected function getMailCC(PhabricatorLiskDAO $object) {
|
||||
return $object->getCCPHIDs();
|
||||
$phids = array();
|
||||
|
||||
foreach ($object->getCCPHIDs() as $phid) {
|
||||
$phids[] = $phid;
|
||||
}
|
||||
|
||||
foreach ($this->heraldEmailPHIDs as $phid) {
|
||||
$phids[] = $phid;
|
||||
}
|
||||
|
||||
return $phids;
|
||||
}
|
||||
|
||||
protected function buildReplyHandler(PhabricatorLiskDAO $object) {
|
||||
|
@ -361,6 +373,8 @@ final class ManiphestTransactionEditor
|
|||
$object->save();
|
||||
}
|
||||
|
||||
$this->heraldEmailPHIDs = $adapter->getEmailPHIDs();
|
||||
|
||||
$xactions = array();
|
||||
|
||||
$assign_phid = $adapter->getAssignPHID();
|
||||
|
|
Loading…
Reference in a new issue