mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-22 19:49:02 +01:00
Fix an off-by-one error affecting mail rendering of inlines on the final line of a file
Summary: Depends on D19837. Ref T13216. See PHI985. There's an off-by-one error here between how inline comments store "length" and how context rendering treats "length". We need to add 1 to the length, but currently do it a little too early. Do it slightly later so that inlines on the final line of a file render properly. Test Plan: Left an inline on the final line of a new file, saw it render properly in HTML mail. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13216 Differential Revision: https://secure.phabricator.com/D19838
This commit is contained in:
parent
97e7ef0f01
commit
bcc90d8c6b
3 changed files with 13 additions and 6 deletions
|
@ -361,7 +361,7 @@ final class DifferentialInlineCommentMailView
|
|||
|
||||
return $parser->render(
|
||||
$start - $context,
|
||||
$length + 1 + (2 * $context),
|
||||
$length + (2 * $context),
|
||||
array());
|
||||
}
|
||||
|
||||
|
|
|
@ -874,9 +874,16 @@ final class DifferentialChangesetParser extends Phobject {
|
|||
$offset_map = $this->old;
|
||||
}
|
||||
|
||||
// NOTE: Inline comments use zero-based lengths. For example, a comment
|
||||
// that starts and ends on line 123 has length 0. Rendering considers
|
||||
// this range to have length 1. Probably both should agree, but that
|
||||
// ship likely sailed long ago. Tweak things here to get the two systems
|
||||
// to agree. See PHI985, where this affected mail rendering of inline
|
||||
// comments left on the final line of a file.
|
||||
|
||||
$range_end = $this->getOffset($offset_map, $range_start + $range_len);
|
||||
$range_start = $this->getOffset($offset_map, $range_start);
|
||||
$range_len = ($range_end - $range_start);
|
||||
$range_len = ($range_end - $range_start) + 1;
|
||||
}
|
||||
|
||||
$render_pch = $this->shouldRenderPropertyChangeHeader($this->changeset);
|
||||
|
|
|
@ -133,9 +133,9 @@ final class PhabricatorFeedStoryPublisher extends Phobject {
|
|||
|
||||
queryfx(
|
||||
$conn,
|
||||
'INSERT INTO %T (objectPHID, chronologicalKey) VALUES %Q',
|
||||
'INSERT INTO %T (objectPHID, chronologicalKey) VALUES %LQ',
|
||||
$ref->getTableName(),
|
||||
implode(', ', $sql));
|
||||
$sql);
|
||||
}
|
||||
|
||||
$subscribed_phids = $this->subscribedPHIDs;
|
||||
|
@ -191,9 +191,9 @@ final class PhabricatorFeedStoryPublisher extends Phobject {
|
|||
$conn,
|
||||
'INSERT INTO %T '.
|
||||
'(primaryObjectPHID, userPHID, chronologicalKey, hasViewed) '.
|
||||
'VALUES %Q',
|
||||
'VALUES %LQ',
|
||||
$notif->getTableName(),
|
||||
implode(', ', $sql));
|
||||
$sql);
|
||||
}
|
||||
|
||||
PhabricatorUserCache::clearCaches(
|
||||
|
|
Loading…
Add table
Reference in a new issue