From 9f9627059a0b17de45a90e3c5fad9c1a49318151 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Wed, 7 Aug 2019 13:18:02 +0200 Subject: Make sure that bookmark sort is consistent, even with equal timestamps Fixes #1348 --- application/bookmark/LinkDB.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'application/bookmark') diff --git a/application/bookmark/LinkDB.php b/application/bookmark/LinkDB.php index efde8468..f01c7ee6 100644 --- a/application/bookmark/LinkDB.php +++ b/application/bookmark/LinkDB.php @@ -102,7 +102,7 @@ class LinkDB implements Iterator, Countable, ArrayAccess $isLoggedIn, $hidePublicLinks ) { - + $this->datastore = $datastore; $this->loggedIn = $isLoggedIn; $this->hidePublicLinks = $hidePublicLinks; @@ -415,7 +415,7 @@ You use the community supported version of the original Shaarli project, by Seba $visibility = 'all', $untaggedonly = false ) { - + // Filter link database according to parameters. $searchtags = isset($filterRequest['searchtags']) ? escape($filterRequest['searchtags']) : ''; $searchterm = isset($filterRequest['searchterm']) ? escape($filterRequest['searchterm']) : ''; @@ -533,6 +533,9 @@ You use the community supported version of the original Shaarli project, by Seba if (isset($a['sticky']) && isset($b['sticky']) && $a['sticky'] !== $b['sticky']) { return $a['sticky'] ? -1 : 1; } + if ($a['created'] == $b['created']) { + return $a['id'] < $b['id'] ? 1 * $order : -1 * $order; + } return $a['created'] < $b['created'] ? 1 * $order : -1 * $order; }); -- cgit v1.2.3