@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+67 -4
+8 -2
src/applications/differential/editor/DifferentialTransactionEditor.php
··· 1201 1201 $body = new PhabricatorMetaMTAMailBody(); 1202 1202 $body->setViewer($this->requireActor()); 1203 1203 1204 - $this->addHeadersAndCommentsToMailBody($body, $xactions); 1204 + $revision_uri = PhabricatorEnv::getProductionURI('/D'.$object->getID()); 1205 + 1206 + $this->addHeadersAndCommentsToMailBody( 1207 + $body, 1208 + $xactions, 1209 + pht('View Revision'), 1210 + $revision_uri); 1205 1211 1206 1212 $type_inline = DifferentialTransaction::TYPE_INLINE; 1207 1213 ··· 1227 1233 1228 1234 $body->addLinkSection( 1229 1235 pht('REVISION DETAIL'), 1230 - PhabricatorEnv::getProductionURI('/D'.$object->getID())); 1236 + $revision_uri); 1231 1237 1232 1238 $update_xaction = null; 1233 1239 foreach ($xactions as $xaction) {
+59 -2
src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
··· 2697 2697 */ 2698 2698 protected function addHeadersAndCommentsToMailBody( 2699 2699 PhabricatorMetaMTAMailBody $body, 2700 - array $xactions) { 2700 + array $xactions, 2701 + $object_label = null, 2702 + $object_href = null) { 2701 2703 2702 2704 $headers = array(); 2703 2705 $comments = array(); ··· 2717 2719 $comments[] = $comment; 2718 2720 } 2719 2721 } 2720 - $body->addRawSection(implode("\n", $headers)); 2722 + 2723 + $headers_text = implode("\n", $headers); 2724 + $body->addRawPlaintextSection($headers_text); 2725 + 2726 + $headers_html = phutil_implode_html(phutil_tag('br'), $headers); 2727 + 2728 + $header_button = null; 2729 + if ($object_label !== null) { 2730 + $button_style = array( 2731 + 'text-decoration: none;', 2732 + 'padding: 4px 8px;', 2733 + 'margin: 0 8px;', 2734 + 'float: right;', 2735 + 'color: #464C5C;', 2736 + 'font-weight: bold;', 2737 + 'border-radius: 3px;', 2738 + 'background-color: #F7F7F9;', 2739 + 'background-image: linear-gradient(to bottom,#fff,#f1f0f1);', 2740 + 'border: 1px solid rgba(71,87,120,.2);', 2741 + ); 2742 + 2743 + $header_button = phutil_tag( 2744 + 'a', 2745 + array( 2746 + 'style' => implode(' ', $button_style), 2747 + 'href' => $object_href, 2748 + ), 2749 + $object_label); 2750 + } 2751 + 2752 + $xactions_style = array( 2753 + 'padding: 0 0 8px 0;', 2754 + ); 2755 + 2756 + $headers_html = phutil_tag( 2757 + 'div', 2758 + array( 2759 + 'style' => implode(' ', $xactions_style), 2760 + ), 2761 + $headers_html); 2762 + 2763 + $header_style = array( 2764 + 'overflow: hidden;', 2765 + ); 2766 + 2767 + $headers_html = phutil_tag( 2768 + 'div', 2769 + array( 2770 + 'style' => implode(' ', $header_style), 2771 + ), 2772 + array( 2773 + $header_button, 2774 + $headers_html, 2775 + )); 2776 + 2777 + $body->addRawHTMLSection($headers_html); 2721 2778 2722 2779 foreach ($comments as $comment) { 2723 2780 $body->addRemarkupSection(null, $comment);