mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-24 06:20:56 +01:00
Send basic email from new ApplicationTransaction editor
Summary: Ref T2222. Adds basic support for email. Test Plan: Received an email via `/editpro/`. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T2222 Differential Revision: https://secure.phabricator.com/D8303
This commit is contained in:
parent
763a049f74
commit
3a8eb28a07
1 changed files with 51 additions and 0 deletions
|
@ -107,6 +107,57 @@ final class DifferentialTransactionEditor
|
||||||
return parent::requireCapabilities($object, $xaction);
|
return parent::requireCapabilities($object, $xaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function shouldSendMail(
|
||||||
|
PhabricatorLiskDAO $object,
|
||||||
|
array $xactions) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getMailTo(PhabricatorLiskDAO $object) {
|
||||||
|
$phids = array();
|
||||||
|
$phids[] = $object->getAuthorPHID();
|
||||||
|
foreach ($object->getReviewerStatus() as $reviewer) {
|
||||||
|
$phids[] = $reviewer->getReviewerPHID();
|
||||||
|
}
|
||||||
|
return $phids;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getMailSubjectPrefix() {
|
||||||
|
return PhabricatorEnv::getEnvConfig('metamta.differential.subject-prefix');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function buildReplyHandler(PhabricatorLiskDAO $object) {
|
||||||
|
return id(new DifferentialReplyHandler())
|
||||||
|
->setMailReceiver($object);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function buildMailTemplate(PhabricatorLiskDAO $object) {
|
||||||
|
$id = $object->getID();
|
||||||
|
$title = $object->getTitle();
|
||||||
|
|
||||||
|
$original_title = $object->getOriginalTitle();
|
||||||
|
|
||||||
|
$subject = "D{$id}: {$title}";
|
||||||
|
$thread_topic = "D{$id}: {$original_title}";
|
||||||
|
|
||||||
|
return id(new PhabricatorMetaMTAMail())
|
||||||
|
->setSubject($subject)
|
||||||
|
->addHeader('Thread-Topic', $thread_topic);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function buildMailBody(
|
||||||
|
PhabricatorLiskDAO $object,
|
||||||
|
array $xactions) {
|
||||||
|
|
||||||
|
$body = parent::buildMailBody($object, $xactions);
|
||||||
|
|
||||||
|
$body->addTextSection(
|
||||||
|
pht('REVISION DETAIL'),
|
||||||
|
PhabricatorEnv::getProductionURI('/D'.$object->getID()));
|
||||||
|
|
||||||
|
return $body;
|
||||||
|
}
|
||||||
|
|
||||||
protected function supportsSearch() {
|
protected function supportsSearch() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue