mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-19 13:22:42 +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
|
<?php
|
||||||
|
|
||||||
/**
|
|
||||||
* @group herald
|
|
||||||
*/
|
|
||||||
final class HeraldManiphestTaskAdapter extends HeraldAdapter {
|
final class HeraldManiphestTaskAdapter extends HeraldAdapter {
|
||||||
|
|
||||||
private $task;
|
private $task;
|
||||||
private $ccPHIDs = array();
|
private $ccPHIDs = array();
|
||||||
private $assignPHID;
|
private $assignPHID;
|
||||||
private $projectPHIDs = array();
|
private $projectPHIDs = array();
|
||||||
|
private $emailPHIDs = array();
|
||||||
|
|
||||||
|
public function getEmailPHIDs() {
|
||||||
|
return $this->emailPHIDs;
|
||||||
|
}
|
||||||
|
|
||||||
public function getAdapterApplicationClass() {
|
public function getAdapterApplicationClass() {
|
||||||
return 'PhabricatorApplicationManiphest';
|
return 'PhabricatorApplicationManiphest';
|
||||||
|
@ -98,6 +100,7 @@ final class HeraldManiphestTaskAdapter extends HeraldAdapter {
|
||||||
case HeraldRuleTypeConfig::RULE_TYPE_GLOBAL:
|
case HeraldRuleTypeConfig::RULE_TYPE_GLOBAL:
|
||||||
return array(
|
return array(
|
||||||
self::ACTION_ADD_CC,
|
self::ACTION_ADD_CC,
|
||||||
|
self::ACTION_EMAIL,
|
||||||
self::ACTION_ASSIGN_TASK,
|
self::ACTION_ASSIGN_TASK,
|
||||||
self::ACTION_ADD_PROJECTS,
|
self::ACTION_ADD_PROJECTS,
|
||||||
self::ACTION_NOTHING,
|
self::ACTION_NOTHING,
|
||||||
|
@ -105,6 +108,7 @@ final class HeraldManiphestTaskAdapter extends HeraldAdapter {
|
||||||
case HeraldRuleTypeConfig::RULE_TYPE_PERSONAL:
|
case HeraldRuleTypeConfig::RULE_TYPE_PERSONAL:
|
||||||
return array(
|
return array(
|
||||||
self::ACTION_ADD_CC,
|
self::ACTION_ADD_CC,
|
||||||
|
self::ACTION_EMAIL,
|
||||||
self::ACTION_FLAG,
|
self::ACTION_FLAG,
|
||||||
self::ACTION_ASSIGN_TASK,
|
self::ACTION_ASSIGN_TASK,
|
||||||
self::ACTION_NOTHING,
|
self::ACTION_NOTHING,
|
||||||
|
@ -161,7 +165,16 @@ final class HeraldManiphestTaskAdapter extends HeraldAdapter {
|
||||||
$result[] = new HeraldApplyTranscript(
|
$result[] = new HeraldApplyTranscript(
|
||||||
$effect,
|
$effect,
|
||||||
true,
|
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;
|
break;
|
||||||
case self::ACTION_FLAG:
|
case self::ACTION_FLAG:
|
||||||
$result[] = parent::applyFlagEffect(
|
$result[] = parent::applyFlagEffect(
|
||||||
|
|
|
@ -17,7 +17,7 @@ final class HeraldRule extends HeraldDAO
|
||||||
protected $isDisabled = 0;
|
protected $isDisabled = 0;
|
||||||
protected $triggerObjectPHID;
|
protected $triggerObjectPHID;
|
||||||
|
|
||||||
protected $configVersion = 33;
|
protected $configVersion = 34;
|
||||||
|
|
||||||
// phids for which this rule has been applied
|
// phids for which this rule has been applied
|
||||||
private $ruleApplied = self::ATTACHABLE;
|
private $ruleApplied = self::ATTACHABLE;
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
final class ManiphestTransactionEditor
|
final class ManiphestTransactionEditor
|
||||||
extends PhabricatorApplicationTransactionEditor {
|
extends PhabricatorApplicationTransactionEditor {
|
||||||
|
|
||||||
|
private $heraldEmailPHIDs = array();
|
||||||
|
|
||||||
public function getTransactionTypes() {
|
public function getTransactionTypes() {
|
||||||
$types = parent::getTransactionTypes();
|
$types = parent::getTransactionTypes();
|
||||||
|
|
||||||
|
@ -271,7 +273,17 @@ final class ManiphestTransactionEditor
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getMailCC(PhabricatorLiskDAO $object) {
|
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) {
|
protected function buildReplyHandler(PhabricatorLiskDAO $object) {
|
||||||
|
@ -361,6 +373,8 @@ final class ManiphestTransactionEditor
|
||||||
$object->save();
|
$object->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->heraldEmailPHIDs = $adapter->getEmailPHIDs();
|
||||||
|
|
||||||
$xactions = array();
|
$xactions = array();
|
||||||
|
|
||||||
$assign_phid = $adapter->getAssignPHID();
|
$assign_phid = $adapter->getAssignPHID();
|
||||||
|
|
Loading…
Reference in a new issue