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

When a transaction adds more than 100 inline comments, include only the first 100 in email

Summary:
Ref T13195. An install had a user apply a transaction which added about 1,000 inline comments. Rendering the email for this transaction took a very long time because the context section for each comment must be highlighted separately.

We can make the highlighting faster (in this case, by porting the lexer to PHP) but it's also sort of silly to include more than 100 inlines in an email. These emails are likely to be truncated by outbound size rules at some point anyway. Instead, limit inlines rendered directly into email to the first 100 per transaction group.

Test Plan:
Set limit to 2, added 4 comments, viewed text and HTML emails:

{F5859967}

{F5859968}

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13195

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

+24
+24
src/applications/differential/editor/DifferentialTransactionEditor.php
··· 892 892 array $inlines, 893 893 PhabricatorMetaMTAMailBody $body) { 894 894 895 + $limit = 100; 896 + $limit_note = null; 897 + if (count($inlines) > $limit) { 898 + $limit_note = pht( 899 + '(Showing first %s of %s inlines.)', 900 + new PhutilNumber($limit), 901 + phutil_count($inlines)); 902 + 903 + $inlines = array_slice($inlines, 0, $limit, true); 904 + } 905 + 895 906 $section = id(new DifferentialInlineCommentMailView()) 896 907 ->setViewer($this->getActor()) 897 908 ->setInlines($inlines) ··· 900 911 $header = pht('INLINE COMMENTS'); 901 912 902 913 $section_text = "\n".$section->getPlaintext(); 914 + if ($limit_note) { 915 + $section_text = $limit_note."\n".$section_text; 916 + } 903 917 904 918 $style = array( 905 919 'margin: 6px 0 12px 0;', ··· 911 925 'style' => implode(' ', $style), 912 926 ), 913 927 $section->getHTML()); 928 + 929 + if ($limit_note) { 930 + $section_html = array( 931 + phutil_tag( 932 + 'em', 933 + array(), 934 + $limit_note), 935 + $section_html, 936 + ); 937 + } 914 938 915 939 $body->addPlaintextSection($header, $section_text, false); 916 940 $body->addHTMLSection($header, $section_html);