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

Never render "Show More Context" inside an inline comment suggestion diff

Summary:
See PHI1896. If you do this:

- Create an inline comment over a wide range of lines.
- Suggest an edit.
- Make a change near the beginning of the block.
- Make a change near the end of the block.
- Save the inline.

...you get a rendering which includes a "Show More Context" fold in the middle.

Currently, this element renders in a visually broken way and consumes too many columns.

However, this element isn't ever desirable inside inline comment suggestions. Stop it from rendering entirely.

Test Plan:
- Made an inline comment suggestion across lines 1-50 with edits at the beginning and end, saw a contiguous diff.
- Made smaller inline comment suggestions (one line, a few lines).

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

+18 -1
+18 -1
src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php
··· 568 568 569 569 $parser->setRenderer($renderer); 570 570 571 - $diff_view = $parser->render(0, 0xFFFF, array()); 571 + // See PHI1896. If a user leaves an inline on a very long range with 572 + // suggestions at the beginning and end, we'll hide context in the middle 573 + // by default. We don't want to do this in the context of an inline 574 + // suggestion, so build a mask to force display of all lines. 575 + 576 + // (We don't know exactly how many lines the diff has, we just know that 577 + // it can't have more lines than the old file plus the new file, so we're 578 + // using that as an upper bound.) 579 + 580 + $min = 0; 581 + 582 + $old_len = count(phutil_split_lines($old_lines)); 583 + $new_len = count(phutil_split_lines($new_lines)); 584 + $max = ($old_len + $new_len); 585 + 586 + $mask = array_fill($min, ($max - $min), true); 587 + 588 + $diff_view = $parser->render($min, ($max - $min), $mask); 572 589 573 590 $view = phutil_tag( 574 591 'div',