Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F17946812
D15459.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D15459.id.diff
View Options
diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -10,7 +10,7 @@
'core.pkg.css' => '9c8e888d',
'core.pkg.js' => '7d8faf57',
'darkconsole.pkg.js' => 'e7393ebb',
- 'differential.pkg.css' => '2de124c9',
+ 'differential.pkg.css' => '7d0a63a7',
'differential.pkg.js' => 'd0cd0df6',
'diffusion.pkg.css' => 'f45955ed',
'diffusion.pkg.js' => '3a9a8bfa',
@@ -59,7 +59,7 @@
'rsrc/css/application/differential/add-comment.css' => 'c47f8c40',
'rsrc/css/application/differential/changeset-view.css' => 'b6b0d1bb',
'rsrc/css/application/differential/core.css' => '7ac3cabc',
- 'rsrc/css/application/differential/phui-inline-comment.css' => '0fdb3667',
+ 'rsrc/css/application/differential/phui-inline-comment.css' => '5953c28e',
'rsrc/css/application/differential/revision-comment.css' => '14b8565a',
'rsrc/css/application/differential/revision-history.css' => '0e8eb855',
'rsrc/css/application/differential/revision-list.css' => 'f3c47d33',
@@ -831,7 +831,7 @@
'phui-image-mask-css' => 'a8498f9c',
'phui-info-panel-css' => '27ea50a1',
'phui-info-view-css' => '6d7c3509',
- 'phui-inline-comment-view-css' => '0fdb3667',
+ 'phui-inline-comment-view-css' => '5953c28e',
'phui-list-view-css' => '9da2aa00',
'phui-object-box-css' => '91628842',
'phui-object-item-list-view-css' => '18b2ce8e',
diff --git a/src/applications/differential/parser/DifferentialChangesetParser.php b/src/applications/differential/parser/DifferentialChangesetParser.php
--- a/src/applications/differential/parser/DifferentialChangesetParser.php
+++ b/src/applications/differential/parser/DifferentialChangesetParser.php
@@ -1000,7 +1000,8 @@
}
}
- $this->comments = msort($this->comments, 'getID');
+ $this->comments = $this->reorderAndThreadComments($this->comments);
+
foreach ($this->comments as $comment) {
$final = $comment->getLineNumber() +
$comment->getLineLength();
@@ -1569,4 +1570,67 @@
return array($old_back, $new_back);
}
+ private function reorderAndThreadComments(array $comments) {
+ $comments = msort($comments, 'getID');
+
+ // Build an empty map of all the comments we actually have. If a comment
+ // is a reply but the parent has gone missing, we don't want it to vanish
+ // completely.
+ $comment_phids = mpull($comments, 'getPHID');
+ $replies = array_fill_keys($comment_phids, array());
+
+ // Now, remove all comments which are replies, leaving only the top-level
+ // comments.
+ foreach ($comments as $key => $comment) {
+ $reply_phid = $comment->getReplyToCommentPHID();
+ if (isset($replies[$reply_phid])) {
+ $replies[$reply_phid][] = $comment;
+ unset($comments[$key]);
+ }
+ }
+
+ // For each top level comment, add the comment, then add any replies
+ // to it. Do this recursively so threads are shown in threaded order.
+ $results = array();
+ foreach ($comments as $comment) {
+ $results[] = $comment;
+ $phid = $comment->getPHID();
+ $descendants = $this->getInlineReplies($replies, $phid, 1);
+ foreach ($descendants as $descendant) {
+ $results[] = $descendant;
+ }
+ }
+
+ // If we have anything left, they were cyclic references. Just dump
+ // them in a the end. This should be impossible, but users are very
+ // creative.
+ foreach ($replies as $phid => $comments) {
+ foreach ($comments as $comment) {
+ $results[] = $comment;
+ }
+ }
+
+ return $results;
+ }
+
+ private function getInlineReplies(array &$replies, $phid, $depth) {
+ $comments = idx($replies, $phid, array());
+ unset($replies[$phid]);
+
+ $results = array();
+ foreach ($comments as $comment) {
+ $results[] = $comment;
+ $descendants = $this->getInlineReplies(
+ $replies,
+ $comment->getPHID(),
+ $depth + 1);
+ foreach ($descendants as $descendant) {
+ $results[] = $descendant;
+ }
+ }
+
+ return $results;
+ }
+
+
}
diff --git a/src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php b/src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php
--- a/src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php
+++ b/src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php
@@ -176,7 +176,7 @@
if ($inline->getHasReplies()) {
$classes[] = 'inline-comment-has-reply';
}
- // I think this is unused
+
if ($inline->getReplyToCommentPHID()) {
$classes[] = 'inline-comment-is-reply';
}
diff --git a/webroot/rsrc/css/application/differential/phui-inline-comment.css b/webroot/rsrc/css/application/differential/phui-inline-comment.css
--- a/webroot/rsrc/css/application/differential/phui-inline-comment.css
+++ b/webroot/rsrc/css/application/differential/phui-inline-comment.css
@@ -61,7 +61,7 @@
/* Tighten up spacing on replies */
.differential-inline-comment.inline-comment-is-reply {
- margin-top: -4px;
+ margin-top: -12px;
}
.differential-inline-comment .inline-head-right {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Aug 1, 3:12 PM (3 d, 20 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
8572404
Default Alt Text
D15459.id.diff (5 KB)
Attached To
Mode
D15459: Partially improve threading UI for adjacent inline comments
Attached
Detach File
Event Timeline
Log In to Comment