1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 00:32:42 +01:00

Differential - re-jigger mail such that inline comments show up right after the main comments.

Summary: Ref T6962. Mainly accomplished by re-factoring the base editor `buildMailBody` function and then using it differently in the `DifferentialTransactionEditor`.

Test Plan: commented on a revision leaving inline feedback. inspected via bin/mail and it looked good! also made a maniphest comment and checked that email, which still looked good.

Reviewers: chad, epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T6962

Differential Revision: https://secure.phabricator.com/D11402
This commit is contained in:
Bob Trahan 2015-01-14 17:23:18 -08:00
parent 923096efc8
commit 57761ce220
2 changed files with 36 additions and 11 deletions

View file

@ -1137,7 +1137,10 @@ final class DifferentialTransactionEditor
PhabricatorLiskDAO $object,
array $xactions) {
$body = parent::buildMailBody($object, $xactions);
$body = new PhabricatorMetaMTAMailBody();
$body->setViewer($this->requireActor());
$this->addHeadersAndCommentsToMailBody($body, $xactions);
$type_inline = DifferentialTransaction::TYPE_INLINE;
@ -1148,6 +1151,12 @@ final class DifferentialTransactionEditor
}
}
if ($inlines) {
$body->addTextSection(
pht('INLINE COMMENTS'),
$this->renderInlineCommentsForMail($object, $inlines));
}
$changed_uri = $this->getChangedPriorToCommitURI();
if ($changed_uri) {
$body->addLinkSection(
@ -1155,11 +1164,7 @@ final class DifferentialTransactionEditor
$changed_uri);
}
if ($inlines) {
$body->addTextSection(
pht('INLINE COMMENTS'),
$this->renderInlineCommentsForMail($object, $inlines));
}
$this->addCustomFieldsToMailBody($body, $object, $xactions);
$body->addLinkSection(
pht('REVISION DETAIL'),

View file

@ -2191,6 +2191,21 @@ abstract class PhabricatorApplicationTransactionEditor
PhabricatorLiskDAO $object,
array $xactions) {
$body = new PhabricatorMetaMTAMailBody();
$body->setViewer($this->requireActor());
$this->addHeadersAndCommentsToMailBody($body, $xactions);
$this->addCustomFieldsToMailBody($body, $object, $xactions);
return $body;
}
/**
* @task mail
*/
protected function addHeadersAndCommentsToMailBody(
PhabricatorMetaMTAMailBody $body,
array $xactions) {
$headers = array();
$comments = array();
@ -2209,14 +2224,20 @@ abstract class PhabricatorApplicationTransactionEditor
$comments[] = $comment;
}
}
$body = new PhabricatorMetaMTAMailBody();
$body->setViewer($this->requireActor());
$body->addRawSection(implode("\n", $headers));
foreach ($comments as $comment) {
$body->addRemarkupSection($comment);
}
}
/**
* @task mail
*/
protected function addCustomFieldsToMailBody(
PhabricatorMetaMTAMailBody $body,
PhabricatorLiskDAO $object,
array $xactions) {
if ($object instanceof PhabricatorCustomFieldInterface) {
$field_list = PhabricatorCustomField::getObjectFields(
@ -2232,11 +2253,10 @@ abstract class PhabricatorApplicationTransactionEditor
$xactions);
}
}
return $body;
}
/* -( Publishing Feed Stories )-------------------------------------------- */