mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-29 16:08:22 +01:00
HTML emails for Calendar event description changes should respect remarkup rules
Summary: Ref T7964, HTML emails for Calendar event description changes should respect remarkup rules Test Plan: Create event and edit description, check that email has a correctly formatted remarkup description section. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: epriestley, Korvin Maniphest Tasks: T7964 Differential Revision: https://secure.phabricator.com/D13554
This commit is contained in:
parent
f8b085c574
commit
28b8c8e212
4 changed files with 14 additions and 15 deletions
|
@ -436,9 +436,9 @@ final class PhabricatorCalendarEventEditor
|
|||
$body = parent::buildMailBody($object, $xactions);
|
||||
|
||||
if (strlen($description)) {
|
||||
$body->addTextSection(
|
||||
$body->addRemarkupSection(
|
||||
pht('EVENT DESCRIPTION'),
|
||||
$object->getDescription());
|
||||
$description);
|
||||
}
|
||||
|
||||
$body->addLinkSection(
|
||||
|
|
|
@ -43,16 +43,16 @@ final class PhabricatorMetaMTAMailBody extends Phobject {
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function addRemarkupSection($text) {
|
||||
public function addRemarkupSection($header, $text) {
|
||||
try {
|
||||
$engine = PhabricatorMarkupEngine::newMarkupEngine(array());
|
||||
$engine->setConfig('viewer', $this->getViewer());
|
||||
$engine->setMode(PhutilRemarkupEngine::MODE_TEXT);
|
||||
$styled_text = $engine->markupText($text);
|
||||
$this->sections[] = $styled_text;
|
||||
$this->addPlaintextSection($header, $styled_text);
|
||||
} catch (Exception $ex) {
|
||||
phlog($ex);
|
||||
$this->sections[] = $text;
|
||||
$this->addTextSection($header, $text);
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -63,14 +63,10 @@ final class PhabricatorMetaMTAMailBody extends Phobject {
|
|||
'uri.base',
|
||||
PhabricatorEnv::getProductionURI('/'));
|
||||
$html = $mail_engine->markupText($text);
|
||||
$this->htmlSections[] = $html;
|
||||
$this->addHTMLSection($header, $html);
|
||||
} catch (Exception $ex) {
|
||||
phlog($ex);
|
||||
$this->htmlSections[] = phutil_escape_html_newlines(
|
||||
phutil_tag(
|
||||
'div',
|
||||
array(),
|
||||
$text));
|
||||
$this->addHTMLSection($header, $text);
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
@ -121,12 +117,16 @@ final class PhabricatorMetaMTAMailBody extends Phobject {
|
|||
}
|
||||
|
||||
public function addHTMLSection($header, $html_fragment) {
|
||||
if ($header !== null) {
|
||||
$header = phutil_tag('strong', array(), $header);
|
||||
}
|
||||
|
||||
$this->htmlSections[] = array(
|
||||
phutil_tag(
|
||||
'div',
|
||||
array(),
|
||||
array(
|
||||
phutil_tag('strong', array(), $header),
|
||||
$header,
|
||||
phutil_tag('div', array(), $html_fragment),
|
||||
)),
|
||||
);
|
||||
|
@ -212,5 +212,4 @@ final class PhabricatorMetaMTAMailBody extends Phobject {
|
|||
private function indent($text) {
|
||||
return rtrim(" ".str_replace("\n", "\n ", $text));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ final class PhortuneCartEditor
|
|||
"%s",
|
||||
$issues);
|
||||
|
||||
$body->addRemarkupSection($overview);
|
||||
$body->addRemarkupSection(null, $overview);
|
||||
|
||||
$body->addLinkSection(
|
||||
pht('PAY NOW'),
|
||||
|
|
|
@ -2668,7 +2668,7 @@ abstract class PhabricatorApplicationTransactionEditor
|
|||
$body->addRawSection(implode("\n", $headers));
|
||||
|
||||
foreach ($comments as $comment) {
|
||||
$body->addRemarkupSection($comment);
|
||||
$body->addRemarkupSection(null, $comment);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue