Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14361897
D8224.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D8224.diff
View Options
Index: src/applications/differential/controller/DifferentialRevisionViewController.php
===================================================================
--- src/applications/differential/controller/DifferentialRevisionViewController.php
+++ src/applications/differential/controller/DifferentialRevisionViewController.php
@@ -260,6 +260,8 @@
$comment_view = $this->buildTransactions(
$revision,
+ $diff_vs ? $diffs[$diff_vs] : $target,
+ $target,
$all_changesets);
$wrap_id = celerity_generate_unique_node_id();
@@ -931,6 +933,8 @@
private function buildTransactions(
DifferentialRevision $revision,
+ DifferentialDiff $left_diff,
+ DifferentialDiff $right_diff,
array $changesets) {
$viewer = $this->getRequest()->getUser();
@@ -947,6 +951,9 @@
->setUser($viewer)
->setObjectPHID($revision->getPHID())
->setChangesets($changesets)
+ ->setRevision($revision)
+ ->setLeftDiff($left_diff)
+ ->setRightDiff($right_diff)
->setTransactions($xactions);
// TODO: Make this work and restore edit links. We need to copy
Index: src/applications/differential/editor/DifferentialRevisionEditor.php
===================================================================
--- src/applications/differential/editor/DifferentialRevisionEditor.php
+++ src/applications/differential/editor/DifferentialRevisionEditor.php
@@ -701,10 +701,18 @@
$template = id(new DifferentialComment())
->setAuthorPHID($this->getActorPHID())
->setRevision($this->revision);
+
if ($this->contentSource) {
- $template->setContentSource($this->contentSource);
+ $content_source = $this->contentSource;
+ } else {
+ $content_source = PhabricatorContentSource::newForSource(
+ PhabricatorContentSource::SOURCE_LEGACY,
+ array());
}
+ $template->setContentSource($content_source);
+
+
// Write the "update active diff" transaction.
id(clone $template)
->setAction(DifferentialAction::ACTION_UPDATE)
Index: src/applications/differential/view/DifferentialTransactionView.php
===================================================================
--- src/applications/differential/view/DifferentialTransactionView.php
+++ src/applications/differential/view/DifferentialTransactionView.php
@@ -4,6 +4,36 @@
extends PhabricatorApplicationTransactionView {
private $changesets;
+ private $revision;
+ private $rightDiff;
+ private $leftDiff;
+
+ public function setLeftDiff(DifferentialDiff $left_diff) {
+ $this->leftDiff = $left_diff;
+ return $this;
+ }
+
+ public function getLeftDiff() {
+ return $this->leftDiff;
+ }
+
+ public function setRightDiff(DifferentialDiff $right_diff) {
+ $this->rightDiff = $right_diff;
+ return $this;
+ }
+
+ public function getRightDiff() {
+ return $this->rightDiff;
+ }
+
+ public function setRevision(DifferentialRevision $revision) {
+ $this->revision = $revision;
+ return $this;
+ }
+
+ public function getRevision() {
+ return $this->revision;
+ }
public function setChangesets(array $changesets) {
assert_instances_of($changesets, 'DifferentialChangeset');
@@ -100,8 +130,8 @@
$by_line = array();
foreach ($group as $inline) {
$by_line[] = array(
- 'line' => $inline->getComment()->getLineNumber().','.
- $inline->getComment()->getLineLength(),
+ 'line' => ((int)$inline->getComment()->getLineNumber() << 16) +
+ ((int)$inline->getComment()->getLineLength()),
'inline' => $inline,
);
}
@@ -119,7 +149,31 @@
'content' => parent::renderTransactionContent($inline),
);
- // TODO: Fix the where/href stuff for nonlocal inlines.
+ $changeset_diff_id = $changeset->getDiffID();
+ if ($comment->getIsNewFile()) {
+ $visible_diff_id = $this->getRightDiff()->getID();
+ } else {
+ $visible_diff_id = $this->getLeftDiff()->getID();
+ }
+
+ // TODO: We still get one edge case wrong here, when we have a
+ // versus diff and the file didn't exist in the old version. The
+ // comment is visible because we show the left side of the target
+ // diff when there's no corresponding file in the versus diff, but
+ // we incorrectly link it off-page.
+
+ $is_visible = ($changeset_diff_id == $visible_diff_id);
+ if (!$is_visible) {
+ $item['where'] = pht('(On Diff #%d)', $changeset_diff_id);
+
+ $revision_id = $this->getRevision()->getID();
+ $comment_id = $comment->getID();
+
+ $item['href'] =
+ "/D".$revision_id.
+ "?id=".$changeset_diff_id.
+ "#inline-".$comment_id;
+ }
$items[] = $item;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 21, 12:09 PM (18 h, 15 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6912123
Default Alt Text
D8224.diff (4 KB)
Attached To
Mode
D8224: Fix inline comment links for non-visible comments
Attached
Detach File
Event Timeline
Log In to Comment