1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-21 13:00:56 +01:00

Provide link to inlines in-context in $ghost['href']

Summary: See D12702.

Test Plan: Made something a link and clicked it, seemed to work OK.

Reviewers: chad

Reviewed By: chad

Subscribers: yelirekim, epriestley

Differential Revision: https://secure.phabricator.com/D12703
This commit is contained in:
epriestley 2015-05-04 11:52:21 -07:00
parent c02db2d15c
commit 460d68ba27
4 changed files with 20 additions and 4 deletions

View file

@ -193,7 +193,11 @@ final class DifferentialChangesetViewController extends DifferentialController {
->setViewer($viewer)
->withRevisionPHIDs(array($revision->getPHID()));
$inlines = $query->execute();
$inlines = $query->adjustInlinesForChangesets($inlines, $old, $new);
$inlines = $query->adjustInlinesForChangesets(
$inlines,
$old,
$new,
$revision);
} else {
$inlines = array();
}

View file

@ -178,7 +178,11 @@ final class DifferentialRevisionViewController extends DifferentialController {
->setViewer($user)
->withRevisionPHIDs(array($revision->getPHID()));
$inlines = $query->execute();
$inlines = $query->adjustInlinesForChangesets($inlines, $old, $new);
$inlines = $query->adjustInlinesForChangesets(
$inlines,
$old,
$new,
$revision);
$visible_changesets = array();
foreach ($inlines as $inline) {

View file

@ -140,7 +140,8 @@ final class DifferentialInlineCommentQuery
public function adjustInlinesForChangesets(
array $inlines,
array $old,
array $new) {
array $new,
DifferentialRevision $revision) {
assert_instances_of($inlines, 'DifferentialInlineComment');
assert_instances_of($old, 'DifferentialChangeset');
@ -302,6 +303,11 @@ final class DifferentialInlineCommentQuery
// If we found a changeset to port this comment to, bring it forward
// or backward and mark it.
if ($target_id) {
$diff_id = $changeset->getDiffID();
$inline_id = $inline->getID();
$revision_id = $revision->getID();
$href = "/D{$revision_id}?id={$diff_id}#inline-{$inline_id}";
$inline
->makeEphemeral(true)
->setChangesetID($target_id)
@ -309,6 +315,7 @@ final class DifferentialInlineCommentQuery
array(
'new' => $is_new,
'reason' => $reason,
'href' => $href,
));
$results[] = $inline;

View file

@ -531,7 +531,8 @@ final class DifferentialRevision extends DifferentialDAO
$query->adjustInlinesForChangesets(
$inlines,
array_select_keys($changesets, $old_ids),
array_select_keys($changesets, $new_ids));
array_select_keys($changesets, $new_ids),
$this);
return $timeline
->setChangesets($changesets)