diff --git a/src/applications/differential/mail/DifferentialInlineCommentMailView.php b/src/applications/differential/mail/DifferentialInlineCommentMailView.php --- a/src/applications/differential/mail/DifferentialInlineCommentMailView.php +++ b/src/applications/differential/mail/DifferentialInlineCommentMailView.php @@ -361,7 +361,7 @@ return $parser->render( $start - $context, - $length + 1 + (2 * $context), + $length + (2 * $context), array()); } diff --git a/src/applications/differential/parser/DifferentialChangesetParser.php b/src/applications/differential/parser/DifferentialChangesetParser.php --- a/src/applications/differential/parser/DifferentialChangesetParser.php +++ b/src/applications/differential/parser/DifferentialChangesetParser.php @@ -874,9 +874,16 @@ $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); diff --git a/src/applications/feed/PhabricatorFeedStoryPublisher.php b/src/applications/feed/PhabricatorFeedStoryPublisher.php --- a/src/applications/feed/PhabricatorFeedStoryPublisher.php +++ b/src/applications/feed/PhabricatorFeedStoryPublisher.php @@ -133,9 +133,9 @@ 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 @@ $conn, 'INSERT INTO %T '. '(primaryObjectPHID, userPHID, chronologicalKey, hasViewed) '. - 'VALUES %Q', + 'VALUES %LQ', $notif->getTableName(), - implode(', ', $sql)); + $sql); } PhabricatorUserCache::clearCaches(