Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15282732
D10279.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D10279.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D10279: basic diff highlighting for html emails
Attached
Detach File
Event Timeline
Log In to Comment