mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 05:50:55 +01:00
Pholio - render inline comments together in an email
Summary: Used Differential emails as a formatting guide. This also includes "Image X: <inline comment>" similarly to how Differential has "<file path><line(s)>: <inline comment>" or what have you. Fixes T3138. Test Plan: inserted some debugging code and verified the mail body format looked okay ish Reviewers: epriestley, chad Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T3138 Differential Revision: https://secure.phabricator.com/D6258
This commit is contained in:
parent
a5ca96a590
commit
0d6e4e2799
1 changed files with 43 additions and 1 deletions
|
@ -120,7 +120,49 @@ final class PholioMockEditor extends PhabricatorApplicationTransactionEditor {
|
||||||
PhabricatorLiskDAO $object,
|
PhabricatorLiskDAO $object,
|
||||||
array $xactions) {
|
array $xactions) {
|
||||||
|
|
||||||
$body = parent::buildMailBody($object, $xactions);
|
$body = new PhabricatorMetaMTAMailBody();
|
||||||
|
$headers = array();
|
||||||
|
$comments = array();
|
||||||
|
$inline_comments = array();
|
||||||
|
|
||||||
|
foreach ($xactions as $xaction) {
|
||||||
|
$comment = $xaction->getComment();
|
||||||
|
switch ($xaction->getTransactionType()) {
|
||||||
|
case PholioTransactionType::TYPE_INLINE:
|
||||||
|
if ($comment && strlen($comment->getContent())) {
|
||||||
|
$inline_comments[] = $comment;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case PhabricatorTransactions::TYPE_COMMENT:
|
||||||
|
if ($comment && strlen($comment->getContent())) {
|
||||||
|
$comments[] = $comment->getContent();
|
||||||
|
}
|
||||||
|
// fallthrough
|
||||||
|
default:
|
||||||
|
$headers[] = id(clone $xaction)
|
||||||
|
->setRenderingTarget('text')
|
||||||
|
->getTitle();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$body->addRawSection(implode("\n", $headers));
|
||||||
|
|
||||||
|
foreach ($comments as $comment) {
|
||||||
|
$body->addRawSection($comment);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($inline_comments) {
|
||||||
|
$body->addRawSection(pht('INLINE COMMENTS'));
|
||||||
|
foreach ($inline_comments as $comment) {
|
||||||
|
$text = pht(
|
||||||
|
'Image %d: %s',
|
||||||
|
$comment->getImageID(),
|
||||||
|
$comment->getContent());
|
||||||
|
$body->addRawSection($text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$body->addTextSection(
|
$body->addTextSection(
|
||||||
pht('MOCK DETAIL'),
|
pht('MOCK DETAIL'),
|
||||||
PhabricatorEnv::getProductionURI('/M'.$object->getID()));
|
PhabricatorEnv::getProductionURI('/M'.$object->getID()));
|
||||||
|
|
Loading…
Reference in a new issue