mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 12:00:55 +01:00
Filter nonvisible inlines out of changeset inline result set
Summary: Ref T7447. After compiling inlines which will appear on the changeset, remove inlines which Later stages remove these anyway, so it doesn't change anything to keep them around, but we can filter them out here cheaply. This will also let us drive the Differential timeline view with the same logic a few diffs from now, to improve how it renders inlines. Generalize things a little bit. Test Plan: - Made a comment on the left of diff 1. - Made diff 2. - Viewed diff 2 vs diff 1. - Verified old-left comment was filtered out by the new loop. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T7447 Differential Revision: https://secure.phabricator.com/D12488
This commit is contained in:
parent
b2d280ff51
commit
b74bb0019e
1 changed files with 23 additions and 9 deletions
|
@ -313,15 +313,15 @@ final class DifferentialChangesetViewController extends DifferentialController {
|
|||
}
|
||||
$changesets += mpull($all, null, 'getID');
|
||||
|
||||
$id_map = array(
|
||||
$left->getID() => $left->getID(),
|
||||
$right->getID() => $right->getID(),
|
||||
);
|
||||
$id_map = array();
|
||||
foreach ($all as $changeset) {
|
||||
$id_map[$changeset->getID()] = $changeset->getID();
|
||||
}
|
||||
|
||||
$name_map = array(
|
||||
$left->getFilename() => $left->getID(),
|
||||
$right->getFilename() => $right->getID(),
|
||||
);
|
||||
$name_map = array();
|
||||
foreach ($all as $changeset) {
|
||||
$name_map[$changeset->getFilename()] = $changeset->getID();
|
||||
}
|
||||
|
||||
$results = array();
|
||||
foreach ($inlines as $inline) {
|
||||
|
@ -335,7 +335,7 @@ final class DifferentialChangesetViewController extends DifferentialController {
|
|||
|
||||
$changeset = idx($changesets, $changeset_id);
|
||||
if (!$changeset) {
|
||||
// Just discard this inline with bogus data.
|
||||
// Just discard this inline, as it has bogus data.
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -360,6 +360,20 @@ final class DifferentialChangesetViewController extends DifferentialController {
|
|||
}
|
||||
}
|
||||
|
||||
// Filter out the inlines we ported forward which won't be visible because
|
||||
// they appear on the wrong side of a file.
|
||||
$keep_map = array();
|
||||
$keep_map[$left->getID()][(int)$left_new] = true;
|
||||
$keep_map[$right->getID()][(int)$right_new] = true;
|
||||
foreach ($results as $key => $inline) {
|
||||
$is_new = (int)$inline->getIsNewFile();
|
||||
$changeset_id = $inline->getChangesetID();
|
||||
if (!isset($keep_map[$changeset_id][$is_new])) {
|
||||
unset($results[$key]);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue