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

Partially improve threading UI for adjacent inline comments

Summary:
Ref T10563. This isn't a complete fix, but should make viewing complex inline threads a little more manageable.

This just tries to put stuff in thread order instead of in pure chronological order. We can likely improve the display treatment -- this is a pretty minimal approach, but should improve clarity.

Test Plan:
T10563 has a "before" shot. Here's the "after":

{F1169018}

This makes it a bit easier to follow the conversations.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10563

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

+70 -6
+3 -3
resources/celerity/map.php
··· 10 10 'core.pkg.css' => '9c8e888d', 11 11 'core.pkg.js' => '7d8faf57', 12 12 'darkconsole.pkg.js' => 'e7393ebb', 13 - 'differential.pkg.css' => '2de124c9', 13 + 'differential.pkg.css' => '7d0a63a7', 14 14 'differential.pkg.js' => 'd0cd0df6', 15 15 'diffusion.pkg.css' => 'f45955ed', 16 16 'diffusion.pkg.js' => '3a9a8bfa', ··· 59 59 'rsrc/css/application/differential/add-comment.css' => 'c47f8c40', 60 60 'rsrc/css/application/differential/changeset-view.css' => 'b6b0d1bb', 61 61 'rsrc/css/application/differential/core.css' => '7ac3cabc', 62 - 'rsrc/css/application/differential/phui-inline-comment.css' => '0fdb3667', 62 + 'rsrc/css/application/differential/phui-inline-comment.css' => '5953c28e', 63 63 'rsrc/css/application/differential/revision-comment.css' => '14b8565a', 64 64 'rsrc/css/application/differential/revision-history.css' => '0e8eb855', 65 65 'rsrc/css/application/differential/revision-list.css' => 'f3c47d33', ··· 831 831 'phui-image-mask-css' => 'a8498f9c', 832 832 'phui-info-panel-css' => '27ea50a1', 833 833 'phui-info-view-css' => '6d7c3509', 834 - 'phui-inline-comment-view-css' => '0fdb3667', 834 + 'phui-inline-comment-view-css' => '5953c28e', 835 835 'phui-list-view-css' => '9da2aa00', 836 836 'phui-object-box-css' => '91628842', 837 837 'phui-object-item-list-view-css' => '18b2ce8e',
+65 -1
src/applications/differential/parser/DifferentialChangesetParser.php
··· 1000 1000 } 1001 1001 } 1002 1002 1003 - $this->comments = msort($this->comments, 'getID'); 1003 + $this->comments = $this->reorderAndThreadComments($this->comments); 1004 + 1004 1005 foreach ($this->comments as $comment) { 1005 1006 $final = $comment->getLineNumber() + 1006 1007 $comment->getLineLength(); ··· 1568 1569 1569 1570 return array($old_back, $new_back); 1570 1571 } 1572 + 1573 + private function reorderAndThreadComments(array $comments) { 1574 + $comments = msort($comments, 'getID'); 1575 + 1576 + // Build an empty map of all the comments we actually have. If a comment 1577 + // is a reply but the parent has gone missing, we don't want it to vanish 1578 + // completely. 1579 + $comment_phids = mpull($comments, 'getPHID'); 1580 + $replies = array_fill_keys($comment_phids, array()); 1581 + 1582 + // Now, remove all comments which are replies, leaving only the top-level 1583 + // comments. 1584 + foreach ($comments as $key => $comment) { 1585 + $reply_phid = $comment->getReplyToCommentPHID(); 1586 + if (isset($replies[$reply_phid])) { 1587 + $replies[$reply_phid][] = $comment; 1588 + unset($comments[$key]); 1589 + } 1590 + } 1591 + 1592 + // For each top level comment, add the comment, then add any replies 1593 + // to it. Do this recursively so threads are shown in threaded order. 1594 + $results = array(); 1595 + foreach ($comments as $comment) { 1596 + $results[] = $comment; 1597 + $phid = $comment->getPHID(); 1598 + $descendants = $this->getInlineReplies($replies, $phid, 1); 1599 + foreach ($descendants as $descendant) { 1600 + $results[] = $descendant; 1601 + } 1602 + } 1603 + 1604 + // If we have anything left, they were cyclic references. Just dump 1605 + // them in a the end. This should be impossible, but users are very 1606 + // creative. 1607 + foreach ($replies as $phid => $comments) { 1608 + foreach ($comments as $comment) { 1609 + $results[] = $comment; 1610 + } 1611 + } 1612 + 1613 + return $results; 1614 + } 1615 + 1616 + private function getInlineReplies(array &$replies, $phid, $depth) { 1617 + $comments = idx($replies, $phid, array()); 1618 + unset($replies[$phid]); 1619 + 1620 + $results = array(); 1621 + foreach ($comments as $comment) { 1622 + $results[] = $comment; 1623 + $descendants = $this->getInlineReplies( 1624 + $replies, 1625 + $comment->getPHID(), 1626 + $depth + 1); 1627 + foreach ($descendants as $descendant) { 1628 + $results[] = $descendant; 1629 + } 1630 + } 1631 + 1632 + return $results; 1633 + } 1634 + 1571 1635 1572 1636 }
+1 -1
src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php
··· 176 176 if ($inline->getHasReplies()) { 177 177 $classes[] = 'inline-comment-has-reply'; 178 178 } 179 - // I think this is unused 179 + 180 180 if ($inline->getReplyToCommentPHID()) { 181 181 $classes[] = 'inline-comment-is-reply'; 182 182 }
+1 -1
webroot/rsrc/css/application/differential/phui-inline-comment.css
··· 61 61 62 62 /* Tighten up spacing on replies */ 63 63 .differential-inline-comment.inline-comment-is-reply { 64 - margin-top: -4px; 64 + margin-top: -12px; 65 65 } 66 66 67 67 .differential-inline-comment .inline-head-right {