1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 00:32:42 +01:00

Render prose diffs in email as summaries

Summary:
Ref T7643. When a large block of prose text is edited (like a wiki page), summarize the diff when sending mail.

For now, I'm still showing the whole thing in the web UI, since it's a bit more manageable there.

Also try to fix newlines in Airmail.

Test Plan:
This web diff:

{F1682591}

..became this mail diff:

{F1682592}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T7643

Differential Revision: https://secure.phabricator.com/D16098
This commit is contained in:
epriestley 2016-06-10 08:13:56 -07:00
parent ad0562e15e
commit fb156af480
3 changed files with 26 additions and 7 deletions

View file

@ -10,7 +10,7 @@ return array(
'core.pkg.css' => '6913fe66',
'core.pkg.js' => '10275c16',
'darkconsole.pkg.js' => 'e7393ebb',
'differential.pkg.css' => 'f3fb8324',
'differential.pkg.css' => 'b3eea3f5',
'differential.pkg.js' => '4b7d8f19',
'diffusion.pkg.css' => '91c5d3a6',
'diffusion.pkg.js' => '3a9a8bfa',
@ -57,7 +57,7 @@ return array(
'rsrc/css/application/dashboard/dashboard.css' => 'bc6f2127',
'rsrc/css/application/diff/inline-comment-summary.css' => '51efda3a',
'rsrc/css/application/differential/add-comment.css' => 'c47f8c40',
'rsrc/css/application/differential/changeset-view.css' => '805f1141',
'rsrc/css/application/differential/changeset-view.css' => 'ccfbc869',
'rsrc/css/application/differential/core.css' => '5b7b8ff4',
'rsrc/css/application/differential/phui-inline-comment.css' => '5953c28e',
'rsrc/css/application/differential/revision-comment.css' => '14b8565a',
@ -553,7 +553,7 @@ return array(
'conpherence-update-css' => 'faf6be09',
'conpherence-widget-pane-css' => '775eaaba',
'd3' => 'a11a5ff2',
'differential-changeset-view-css' => '805f1141',
'differential-changeset-view-css' => 'ccfbc869',
'differential-core-view-css' => '5b7b8ff4',
'differential-inline-comment-editor' => '64a5550f',
'differential-revision-add-comment-css' => 'c47f8c40',
@ -1528,9 +1528,6 @@ return array(
'javelin-vector',
'javelin-stratcom',
),
'805f1141' => array(
'phui-inline-comment-view-css',
),
'834a1173' => array(
'javelin-behavior',
'javelin-scrollbar',
@ -1926,6 +1923,9 @@ return array(
'javelin-util',
'phabricator-notification-css',
),
'ccfbc869' => array(
'phui-inline-comment-view-css',
),
'cf86d16a' => array(
'javelin-behavior',
'javelin-dom',

View file

@ -33,11 +33,24 @@ final class PhabricatorApplicationTransactionTextDiffDetailView
);
$new_styles = implode(' ', $new_styles);
$omit_styles = array(
'padding: 8px 0;',
);
$omit_styles = implode(' ', $omit_styles);
$result = array();
foreach ($diff->getParts() as $part) {
foreach ($diff->getSummaryParts() as $part) {
$type = $part['type'];
$text = $part['text'];
switch ($type) {
case '.':
$result[] = phutil_tag(
'div',
array(
'style' => $omit_styles,
),
pht('...'));
break;
case '-':
$result[] = phutil_tag(
'span',
@ -62,8 +75,13 @@ final class PhabricatorApplicationTransactionTextDiffDetailView
$styles = array(
'white-space: pre-wrap;',
'color: #74777D;',
);
// Beyond applying "pre-wrap", convert newlines to "<br />" explicitly
// to improve behavior in clients like Airmail.
$result = phutil_escape_html_newlines($result);
return phutil_tag(
'div',
array(

View file

@ -95,6 +95,7 @@
.prose-diff {
white-space: pre-wrap;
color: {$greytext};
}
.prose-diff-frame {