Differential D16063 Diff 38653 src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
Show First 20 Lines • Show All 2,698 Lines • ▼ Show 20 Lines | /* -( Sending Mail )------------------------------------------------------- */ | ||||
*/ | */ | ||||
protected function addHeadersAndCommentsToMailBody( | protected function addHeadersAndCommentsToMailBody( | ||||
PhabricatorMetaMTAMailBody $body, | PhabricatorMetaMTAMailBody $body, | ||||
array $xactions, | array $xactions, | ||||
$object_label = null, | $object_label = null, | ||||
$object_href = null) { | $object_href = null) { | ||||
$headers = array(); | $headers = array(); | ||||
$headers_html = array(); | |||||
$comments = array(); | $comments = array(); | ||||
$details = array(); | |||||
foreach ($xactions as $xaction) { | foreach ($xactions as $xaction) { | ||||
if ($xaction->shouldHideForMail($xactions)) { | if ($xaction->shouldHideForMail($xactions)) { | ||||
continue; | continue; | ||||
} | } | ||||
$header = $xaction->getTitleForMail(); | $header = $xaction->getTitleForMail(); | ||||
if ($header !== null) { | if ($header !== null) { | ||||
$headers[] = $header; | $headers[] = $header; | ||||
} | } | ||||
$header_html = $xaction->getTitleForHTMLMail(); | |||||
if ($header_html !== null) { | |||||
$headers_html[] = $header_html; | |||||
} | |||||
$comment = $xaction->getBodyForMail(); | $comment = $xaction->getBodyForMail(); | ||||
if ($comment !== null) { | if ($comment !== null) { | ||||
$comments[] = $comment; | $comments[] = $comment; | ||||
} | } | ||||
if ($xaction->hasChangeDetailsForMail()) { | |||||
$details[] = $xaction; | |||||
} | |||||
} | } | ||||
$headers_text = implode("\n", $headers); | $headers_text = implode("\n", $headers); | ||||
$body->addRawPlaintextSection($headers_text); | $body->addRawPlaintextSection($headers_text); | ||||
$headers_html = phutil_implode_html(phutil_tag('br'), $headers); | $headers_html = phutil_implode_html(phutil_tag('br'), $headers_html); | ||||
$header_button = null; | $header_button = null; | ||||
if ($object_label !== null) { | if ($object_label !== null) { | ||||
$button_style = array( | $button_style = array( | ||||
'text-decoration: none;', | 'text-decoration: none;', | ||||
'padding: 4px 8px;', | 'padding: 4px 8px;', | ||||
'margin: 0 8px 8px;', | 'margin: 0 8px 8px;', | ||||
'float: right;', | 'float: right;', | ||||
Show All 23 Lines | $header_action = phutil_tag( | ||||
array(), | array(), | ||||
$header_button); | $header_button); | ||||
$header_action = phutil_tag( | $header_action = phutil_tag( | ||||
'td', | 'td', | ||||
array( | array( | ||||
'style' => implode(' ', $xactions_style), | 'style' => implode(' ', $xactions_style), | ||||
), | ), | ||||
$headers_html); | array( | ||||
$headers_html, | |||||
// Add an extra newline to prevent the "View Object" button from | |||||
// running into the transaction text in Mail.app text snippet | |||||
// previews. | |||||
"\n", | |||||
)); | |||||
$headers_html = phutil_tag( | $headers_html = phutil_tag( | ||||
'table', | 'table', | ||||
array(), | array(), | ||||
phutil_tag('tr', array(), array($header_action, $header_button))); | phutil_tag('tr', array(), array($header_action, $header_button))); | ||||
$body->addRawHTMLSection($headers_html); | $body->addRawHTMLSection($headers_html); | ||||
foreach ($comments as $comment) { | foreach ($comments as $comment) { | ||||
$body->addRemarkupSection(null, $comment); | $body->addRemarkupSection(null, $comment); | ||||
} | } | ||||
foreach ($details as $xaction) { | |||||
$details = $xaction->renderChangeDetailsForMail($body->getViewer()); | |||||
if ($details !== null) { | |||||
$body->addHTMLSection(pht('EDIT DETAILS'), $details); | |||||
} | |||||
} | |||||
} | } | ||||
/** | /** | ||||
* @task mail | * @task mail | ||||
*/ | */ | ||||
protected function addCustomFieldsToMailBody( | protected function addCustomFieldsToMailBody( | ||||
PhabricatorMetaMTAMailBody $body, | PhabricatorMetaMTAMailBody $body, | ||||
PhabricatorLiskDAO $object, | PhabricatorLiskDAO $object, | ||||
▲ Show 20 Lines • Show All 865 Lines • Show Last 20 Lines |