Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15193846
D12497.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
D12497.diff
View Options
diff --git a/src/applications/differential/controller/DifferentialRevisionViewController.php b/src/applications/differential/controller/DifferentialRevisionViewController.php
--- a/src/applications/differential/controller/DifferentialRevisionViewController.php
+++ b/src/applications/differential/controller/DifferentialRevisionViewController.php
@@ -90,6 +90,23 @@
$repository);
}
+ $map = $vs_map;
+ if (!$map) {
+ $map = array_fill_keys(array_keys($changesets), 0);
+ }
+
+ $old_ids = array();
+ $new_ids = array();
+ foreach ($map as $id => $vs) {
+ if ($vs <= 0) {
+ $old_ids[] = $id;
+ $new_ids[] = $id;
+ } else {
+ $new_ids[] = $id;
+ $new_ids[] = $vs;
+ }
+ }
+
$props = id(new DifferentialDiffProperty())->loadAllWhere(
'diffID = %d',
$target_manual->getID());
@@ -154,24 +171,8 @@
pht('Show All Files Inline'))));
$warning = $warning->render();
- $map = $vs_map;
- if (!$map) {
- $map = array_fill_keys(array_keys($changesets), 0);
- }
-
- $old = array();
- $new = array();
- foreach ($map as $id => $vs) {
- if ($vs <= 0) {
- $old[] = $id;
- $new[] = $id;
- } else {
- $new[] = $id;
- $new[] = $vs;
- }
- }
- $old = array_select_keys($changesets, $old);
- $new = array_select_keys($changesets, $new);
+ $old = array_select_keys($changesets, $old_ids);
+ $new = array_select_keys($changesets, $new_ids);
$query = id(new DifferentialInlineCommentQuery())
->setViewer($user)
@@ -285,7 +286,9 @@
$comment_view = $this->buildTransactions(
$revision,
$diff_vs ? $diffs[$diff_vs] : $target,
- $target);
+ $target,
+ $old_ids,
+ $new_ids);
if (!$viewer_is_anonymous) {
$comment_view->setQuoteRef('D'.$revision->getID());
@@ -931,7 +934,9 @@
private function buildTransactions(
DifferentialRevision $revision,
DifferentialDiff $left_diff,
- DifferentialDiff $right_diff) {
+ DifferentialDiff $right_diff,
+ array $old_ids,
+ array $new_ids) {
$timeline = $this->buildTransactionTimeline(
$revision,
@@ -940,6 +945,8 @@
array(
'left' => $left_diff->getID(),
'right' => $right_diff->getID(),
+ 'old' => implode(',', $old_ids),
+ 'new' => implode(',', $new_ids),
));
return $timeline;
diff --git a/src/applications/differential/query/DifferentialInlineCommentQuery.php b/src/applications/differential/query/DifferentialInlineCommentQuery.php
--- a/src/applications/differential/query/DifferentialInlineCommentQuery.php
+++ b/src/applications/differential/query/DifferentialInlineCommentQuery.php
@@ -151,6 +151,18 @@
$changeset_ids = mpull($inlines, 'getChangesetID');
$changeset_ids = array_unique($changeset_ids);
+
+ $all_map = mpull($all, null, 'getID');
+
+ // We already have at least some changesets, and we might not need to do
+ // any more data fetching. Remove everything we already have so we can
+ // tell if we need new stuff.
+ foreach ($changeset_ids as $key => $id) {
+ if (isset($all_map[$id])) {
+ unset($changeset_ids[$key]);
+ }
+ }
+
if ($changeset_ids) {
$changesets = id(new DifferentialChangesetQuery())
->setViewer($viewer)
@@ -160,7 +172,7 @@
} else {
$changesets = array();
}
- $changesets += mpull($all, null, 'getID');
+ $changesets += $all_map;
$id_map = array();
foreach ($all as $changeset) {
diff --git a/src/applications/differential/storage/DifferentialRevision.php b/src/applications/differential/storage/DifferentialRevision.php
--- a/src/applications/differential/storage/DifferentialRevision.php
+++ b/src/applications/differential/storage/DifferentialRevision.php
@@ -478,6 +478,7 @@
public function willRenderTimeline(
PhabricatorApplicationTransactionView $timeline,
AphrontRequest $request) {
+ $viewer = $request->getViewer();
$render_data = $timeline->getRenderData();
$left = $request->getInt('left', idx($render_data, 'left'));
@@ -491,10 +492,17 @@
$left_diff = $diffs[$left];
$right_diff = $diffs[$right];
+ $old_ids = $request->getStr('old', idx($render_data, 'old'));
+ $new_ids = $request->getStr('new', idx($render_data, 'new'));
+ $old_ids = explode(',', $old_ids);
+ $new_ids = explode(',', $new_ids);
+
$type_inline = DifferentialTransaction::TYPE_INLINE;
- $changeset_ids = array();
+ $changeset_ids = array_merge($old_ids, $new_ids);
+ $inlines = array();
foreach ($timeline->getTransactions() as $xaction) {
if ($xaction->getTransactionType() == $type_inline) {
+ $inlines[] = $xaction->getComment();
$changeset_ids[] = $xaction->getComment()->getChangesetID();
}
}
@@ -509,6 +517,22 @@
$changesets = array();
}
+ foreach ($inlines as $key => $inline) {
+ $inlines[$key] = DifferentialInlineComment::newFromModernComment(
+ $inline);
+ }
+
+ $query = id(new DifferentialInlineCommentQuery())
+ ->setViewer($viewer);
+
+ // NOTE: This is a bit sketchy: this method adjusts the inlines as a
+ // side effect, which means it will ultimately adjust the transaction
+ // comments and affect timeline rendering.
+ $query->adjustInlinesForChangesets(
+ $inlines,
+ array_select_keys($changesets, $old_ids),
+ array_select_keys($changesets, $new_ids));
+
return $timeline
->setChangesets($changesets)
->setRevision($this)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Feb 23, 6:58 AM (7 h, 54 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7185167
Default Alt Text
D12497.diff (5 KB)
Attached To
Mode
D12497: Make Differential timeline aware of ghostly inlines
Attached
Detach File
Event Timeline
Log In to Comment