1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-18 18:51:12 +01:00

Sort inline comments by id in case of ties

Summary: This ensures that two comments by the same author on the same line are sorted properly.

Test Plan: Before this patch, made two comments that appeared in the wrong order. With this patch, they sort correctly.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D8697
This commit is contained in:
Ben Alpert 2014-04-03 18:41:49 -07:00 committed by epriestley
parent 8fad146832
commit f9a92c7631

View file

@ -44,12 +44,13 @@ final class DifferentialTransactionComment
$items = array();
foreach ($group as $inline) {
$comment = $inline->getComment();
$num = (int)$comment->getLineNumber();
$len = (int)$comment->getLineLength();
$num = $comment->getLineNumber();
$len = $comment->getLineLength();
$id = $comment->getID();
$items[] = array(
'inline' => $inline,
'sort' => ($num << 16) + $len,
'sort' => sprintf('~%010d%010d%010d', $num, $len, $id),
);
}