@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.

Refine inline style rendering in email

Summary: Ref T10694. Move the inline style more toward a mix of standard`<pre>` style and the web UI style for inlines.

Test Plan: See screenshots in comments.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10694

Differential Revision: https://secure.phabricator.com/D15857

+104 -28
+103 -27
src/applications/differential/mail/DifferentialInlineCommentMailView.php
··· 82 82 $render_html = $this->renderInline($comment, true, false); 83 83 84 84 $section->addPlaintextFragment($context_text); 85 - $section->addHTMLFragment($context_html); 85 + $section->addPlaintextFragment($spacer_text); 86 + $section->addPlaintextFragment($render_text); 87 + 88 + $style = array( 89 + 'border: 1px solid #C7CCD9;', 90 + 'border-radius: 3px;', 91 + ); 86 92 87 - $section->addPlaintextFragment($spacer_text); 93 + $html_fragment = phutil_tag( 94 + 'div', 95 + array( 96 + 'style' => implode(' ', $style), 97 + ), 98 + array( 99 + $context_html, 100 + $render_html, 101 + )); 88 102 89 - $section->addPlaintextFragment($render_text); 90 - $section->addHTMLFragment($render_html); 103 + $section->addHTMLFragment($html_fragment); 91 104 92 105 if (!$is_last_group || !$is_last_inline) { 93 106 $section->addPlaintextFragment($spacer_text); ··· 181 194 $content = $this->renderRemarkupContent($content, $is_html); 182 195 183 196 if ($is_quote) { 184 - if ($is_html) { 185 - $style = array( 186 - 'padding: 4px 0;', 187 - ); 188 - 189 - $content = phutil_tag( 190 - 'div', 191 - array( 192 - 'style' => implode(' ', $style), 193 - ), 194 - $content); 195 - } 196 197 $header = $this->renderHeader($comment, $is_html, true); 197 198 } else { 198 199 $header = null; 199 200 } 200 201 202 + if ($is_html) { 203 + $style = array( 204 + 'padding: 8px 12px;', 205 + ); 206 + 207 + if ($is_quote) { 208 + $style[] = 'color: #74777D;'; 209 + } 210 + 211 + $content = phutil_tag( 212 + 'div', 213 + array( 214 + 'style' => implode(' ', $style), 215 + ), 216 + $content); 217 + } 218 + 201 219 $parts = array( 202 220 $header, 203 221 "\n", ··· 230 248 $mode = PhutilRemarkupEngine::MODE_TEXT; 231 249 } 232 250 251 + $attributes = array( 252 + 'style' => 'padding: 0; margin: 0;', 253 + ); 254 + 233 255 $engine = PhabricatorMarkupEngine::newMarkupEngine(array()) 234 256 ->setConfig('viewer', $viewer) 235 257 ->setConfig('uri.base', $production_uri) 258 + ->setConfig('default.p.attributes', $attributes) 236 259 ->setMode($mode); 237 260 238 261 try { ··· 264 287 265 288 private function quoteHTML($block) { 266 289 $styles = array( 267 - 'padding: 4px 8px;', 268 - 'background: #F8F9FC;', 269 - 'border-left: 3px solid #a7b5bf;', 270 - 'margin: 4px 0 0;', 290 + 'padding: 0;', 291 + 'background: #F7F7F7;', 292 + 'border-color: #e3e4e8;', 293 + 'border-style: solid;', 294 + 'border-width: 0 0 1px 0;', 295 + 'margin: 0;', 271 296 ); 272 297 273 298 $styles = implode(' ', $styles); ··· 389 414 $changeset = $this->getChangeset($comment->getChangesetID()); 390 415 $path = $changeset->getFilename(); 391 416 417 + // Only show the filename. 418 + $path = basename($path); 419 + 392 420 $start = $comment->getLineNumber(); 393 421 $length = $comment->getLineLength(); 394 422 if ($length) { ··· 402 430 $header = phutil_tag( 403 431 'span', 404 432 array( 405 - 'style' => 'color: #000000', 433 + 'style' => 'color: #4b4d51; font-weight: bold;', 406 434 ), 407 435 $header); 408 436 } ··· 414 442 } 415 443 416 444 if ($author) { 417 - $byline = '@'.$author->getName(); 445 + $byline = $author->getName(); 418 446 419 447 if ($is_html) { 420 448 $byline = phutil_tag( 421 449 'span', 422 450 array( 423 - 'style' => 'color: #000000', 451 + 'style' => 'color: #4b4d51; font-weight: bold;', 424 452 ), 425 453 $byline); 426 454 } 427 455 428 456 $header = pht('%s wrote in %s', $byline, $header); 429 - } else { 430 - $header = pht('In %s', $header); 431 457 } 432 458 433 459 if ($is_html) { 460 + $link_href = $this->getInlineURI($comment); 461 + if ($link_href) { 462 + $link_style = array( 463 + 'float: right;', 464 + ); 465 + 466 + $link = phutil_tag( 467 + 'a', 468 + array( 469 + 'style' => implode(' ', $link_style), 470 + 'href' => $link_href, 471 + ), 472 + pht('View Inline')); 473 + } else { 474 + $link = null; 475 + } 476 + 477 + $style = array( 478 + 'color: #74777d;', 479 + 'background: #eff2f4;', 480 + 'padding: 4px 8px;', 481 + 'overflow: hidden;', 482 + ); 483 + 434 484 $header = phutil_tag( 435 485 'div', 436 486 array( 437 - 'style' => 'font-style: italic; color: #74777d', 487 + 'style' => implode(' ', $style), 438 488 ), 439 - $header); 489 + array( 490 + $link, 491 + $header, 492 + )); 440 493 } 441 494 442 495 return $header; 443 496 } 497 + 498 + private function getInlineURI(DifferentialTransactionComment $comment) { 499 + $changeset = $this->getChangeset($comment->getChangesetID()); 500 + if (!$changeset) { 501 + return null; 502 + } 503 + 504 + $diff = $changeset->getDiff(); 505 + if (!$diff) { 506 + return null; 507 + } 508 + 509 + $revision = $diff->getRevision(); 510 + if (!$revision) { 511 + return null; 512 + } 513 + 514 + $link_href = '/'.$revision->getMonogram().'#inline-'.$comment->getID(); 515 + $link_href = PhabricatorEnv::getProductionURI($link_href); 516 + 517 + return $link_href; 518 + } 519 + 444 520 445 521 }
+1 -1
src/applications/differential/render/DifferentialChangesetOneUpMailRenderer.php
··· 73 73 } 74 74 } 75 75 76 - $style = "padding: 0 2px; {$style}"; 76 + $style = "padding: 0 8px; margin: 0 4px; {$style}"; 77 77 78 78 $out[] = phutil_tag( 79 79 'div',