mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-21 13:00:56 +01:00
Add a "View Revision" button to HTML email
Summary: Ref T10694. If this feels good, I'd plan to eventually add something similar to other applications ("View Task", etc). Not sure if we should keep the object link later in the mail body or not. I left it for now. Test Plan: {F1307256, size=full} Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T10694 Differential Revision: https://secure.phabricator.com/D15884
This commit is contained in:
parent
9d029519f6
commit
5bb3cbe239
2 changed files with 67 additions and 4 deletions
|
@ -1201,7 +1201,13 @@ final class DifferentialTransactionEditor
|
|||
$body = new PhabricatorMetaMTAMailBody();
|
||||
$body->setViewer($this->requireActor());
|
||||
|
||||
$this->addHeadersAndCommentsToMailBody($body, $xactions);
|
||||
$revision_uri = PhabricatorEnv::getProductionURI('/D'.$object->getID());
|
||||
|
||||
$this->addHeadersAndCommentsToMailBody(
|
||||
$body,
|
||||
$xactions,
|
||||
pht('View Revision'),
|
||||
$revision_uri);
|
||||
|
||||
$type_inline = DifferentialTransaction::TYPE_INLINE;
|
||||
|
||||
|
@ -1227,7 +1233,7 @@ final class DifferentialTransactionEditor
|
|||
|
||||
$body->addLinkSection(
|
||||
pht('REVISION DETAIL'),
|
||||
PhabricatorEnv::getProductionURI('/D'.$object->getID()));
|
||||
$revision_uri);
|
||||
|
||||
$update_xaction = null;
|
||||
foreach ($xactions as $xaction) {
|
||||
|
|
|
@ -2697,7 +2697,9 @@ abstract class PhabricatorApplicationTransactionEditor
|
|||
*/
|
||||
protected function addHeadersAndCommentsToMailBody(
|
||||
PhabricatorMetaMTAMailBody $body,
|
||||
array $xactions) {
|
||||
array $xactions,
|
||||
$object_label = null,
|
||||
$object_href = null) {
|
||||
|
||||
$headers = array();
|
||||
$comments = array();
|
||||
|
@ -2717,7 +2719,62 @@ abstract class PhabricatorApplicationTransactionEditor
|
|||
$comments[] = $comment;
|
||||
}
|
||||
}
|
||||
$body->addRawSection(implode("\n", $headers));
|
||||
|
||||
$headers_text = implode("\n", $headers);
|
||||
$body->addRawPlaintextSection($headers_text);
|
||||
|
||||
$headers_html = phutil_implode_html(phutil_tag('br'), $headers);
|
||||
|
||||
$header_button = null;
|
||||
if ($object_label !== null) {
|
||||
$button_style = array(
|
||||
'text-decoration: none;',
|
||||
'padding: 4px 8px;',
|
||||
'margin: 0 8px;',
|
||||
'float: right;',
|
||||
'color: #464C5C;',
|
||||
'font-weight: bold;',
|
||||
'border-radius: 3px;',
|
||||
'background-color: #F7F7F9;',
|
||||
'background-image: linear-gradient(to bottom,#fff,#f1f0f1);',
|
||||
'border: 1px solid rgba(71,87,120,.2);',
|
||||
);
|
||||
|
||||
$header_button = phutil_tag(
|
||||
'a',
|
||||
array(
|
||||
'style' => implode(' ', $button_style),
|
||||
'href' => $object_href,
|
||||
),
|
||||
$object_label);
|
||||
}
|
||||
|
||||
$xactions_style = array(
|
||||
'padding: 0 0 8px 0;',
|
||||
);
|
||||
|
||||
$headers_html = phutil_tag(
|
||||
'div',
|
||||
array(
|
||||
'style' => implode(' ', $xactions_style),
|
||||
),
|
||||
$headers_html);
|
||||
|
||||
$header_style = array(
|
||||
'overflow: hidden;',
|
||||
);
|
||||
|
||||
$headers_html = phutil_tag(
|
||||
'div',
|
||||
array(
|
||||
'style' => implode(' ', $header_style),
|
||||
),
|
||||
array(
|
||||
$header_button,
|
||||
$headers_html,
|
||||
));
|
||||
|
||||
$body->addRawHTMLSection($headers_html);
|
||||
|
||||
foreach ($comments as $comment) {
|
||||
$body->addRemarkupSection(null, $comment);
|
||||
|
|
Loading…
Reference in a new issue