Page MenuHomePhabricator

D10279.diff
No OneTemporary

D10279.diff

diff --git a/src/applications/differential/editor/DifferentialTransactionEditor.php b/src/applications/differential/editor/DifferentialTransactionEditor.php
--- a/src/applications/differential/editor/DifferentialTransactionEditor.php
+++ b/src/applications/differential/editor/DifferentialTransactionEditor.php
@@ -1827,8 +1827,30 @@
}
private function renderPatchHTMLForMail($patch) {
+ $patch_html_lines = array();
+ foreach (phutil_split_lines($patch) as $line) {
+ $len = strlen($line);
+ $color = null;
+ if ($len >= 1 && $line[0] == '+') {
+ $color = 'green';
+ } else if ($len >= 1 && $line[0] == '-') {
+ $color = 'red';
+ } else if ($len >= 2 && substr($line, 0, 2) == '@@') {
+ $color = 'purple';
+ }
+
+ $attrib = array();
+
+ if ($color) {
+ $attrib['style'] = "color:{$color};";
+ }
+
+ $patch_html_lines[] = phutil_tag('span', $attrib, $line);
+ }
+
return phutil_tag('pre',
- array('style' => 'font-family: monospace;'), $patch);
+ array('style' => 'font-family: monospace;'),
+ $patch_html_lines);
}
private function renderPatchForMail(DifferentialDiff $diff) {

File Metadata

Mime Type
text/plain
Expires
Mar 5 2025, 1:54 AM (6 w, 21 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7223322
Default Alt Text
D10279.diff (1 KB)

Event Timeline