Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15409986
D17184.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D17184.id.diff
View Options
diff --git a/src/applications/audit/view/PhabricatorAuditTransactionView.php b/src/applications/audit/view/PhabricatorAuditTransactionView.php
--- a/src/applications/audit/view/PhabricatorAuditTransactionView.php
+++ b/src/applications/audit/view/PhabricatorAuditTransactionView.php
@@ -81,48 +81,58 @@
}
}
- if ($inlines) {
-
- // TODO: This should do something similar to sortAndGroupInlines() to get
- // a stable ordering.
-
- $inlines_by_path = array();
- foreach ($inlines as $key => $inline) {
- $comment = $inline->getComment();
- if (!$comment) {
- // TODO: Migrate these away? They probably do not exist on normal
- // non-development installs.
- unset($inlines[$key]);
- continue;
- }
- $path_id = $comment->getPathID();
- $inlines_by_path[$path_id][] = $inline;
+ $structs = array();
+ foreach ($inlines as $key => $inline) {
+ $comment = $inline->getComment();
+ if (!$comment) {
+ // TODO: Migrate these away? They probably do not exist on normal
+ // non-development installs.
+ unset($inlines[$key]);
+ continue;
}
- $inline_view = new PhabricatorInlineSummaryView();
- foreach ($inlines_by_path as $path_id => $group) {
- $path = idx($this->pathMap, $path_id);
- if ($path === null) {
- continue;
- }
-
- $items = array();
- foreach ($group as $inline) {
- $comment = $inline->getComment();
- $item = array(
- 'id' => $comment->getID(),
- 'line' => $comment->getLineNumber(),
- 'length' => $comment->getLineLength(),
- 'content' => parent::renderTransactionContent($inline),
- );
- $items[] = $item;
- }
- $inline_view->addCommentGroup($path, $items);
+ $path_id = $comment->getPathID();
+ $path = idx($this->pathMap, $path_id);
+ if ($path === null) {
+ continue;
}
- $out[] = $inline_view;
+ $structs[] = array(
+ 'inline' => $inline,
+ 'path' => $path,
+ 'sort' => (string)id(new PhutilSortVector())
+ ->addString($path)
+ ->addInt($comment->getLineNumber())
+ ->addInt($comment->getLineLength())
+ ->addInt($inline->getID()),
+ );
+ }
+
+ if (!$structs) {
+ return $out;
+ }
+
+ $structs = isort($structs, 'sort');
+ $structs = igroup($structs, 'path');
+
+ $inline_view = new PhabricatorInlineSummaryView();
+ foreach ($structs as $path => $group) {
+ $inlines = ipull($group, 'inline');
+ $items = array();
+ foreach ($inlines as $inline) {
+ $comment = $inline->getComment();
+ $items[] = array(
+ 'id' => $comment->getID(),
+ 'line' => $comment->getLineNumber(),
+ 'length' => $comment->getLineLength(),
+ 'content' => parent::renderTransactionContent($inline),
+ );
+ }
+ $inline_view->addCommentGroup($path, $items);
}
+ $out[] = $inline_view;
+
return $out;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mar 20 2025, 6:23 AM (6 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7710587
Default Alt Text
D17184.id.diff (3 KB)
Attached To
Mode
D17184: Order inline comments in Diffusion consistently with Differential
Attached
Detach File
Event Timeline
Log In to Comment