summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2020-06-09 10:33:41 +0200
committerGitHub <noreply@github.com>2020-06-09 10:33:41 +0200
commit19712e2773157c2f249e3f124b0d5e2adff7a1eb (patch)
tree5871d157c77ba961820883c26f943f7c22ee101d
parent3f07485a045339dfb1dd6f6e3d38d2115bb31041 (diff)
parent56b04c65f72664d94050b72eb633bf279f674af3 (diff)
downloadnextcloud-server-19712e2773157c2f249e3f124b0d5e2adff7a1eb.tar.gz
nextcloud-server-19712e2773157c2f249e3f124b0d5e2adff7a1eb.zip
Merge pull request #21311 from nextcloud/techdebt/noid/make-share-order-reliable
Always sort shares in a reliable way
-rw-r--r--apps/files_sharing/lib/MountProvider.php8
-rw-r--r--lib/public/Share/IShare.php2
2 files changed, 6 insertions, 4 deletions
diff --git a/apps/files_sharing/lib/MountProvider.php b/apps/files_sharing/lib/MountProvider.php
index 43306fe2e7e..82d74479d4b 100644
--- a/apps/files_sharing/lib/MountProvider.php
+++ b/apps/files_sharing/lib/MountProvider.php
@@ -156,10 +156,12 @@ class MountProvider implements IMountProvider {
// sort by stime, the super share will be based on the least recent share
foreach ($tmp as &$tmp2) {
@usort($tmp2, function ($a, $b) {
- if ($a->getShareTime() <= $b->getShareTime()) {
- return -1;
+ $aTime = $a->getShareTime()->getTimestamp();
+ $bTime = $b->getShareTime()->getTimestamp();
+ if ($aTime === $bTime) {
+ return $a->getId() < $b->getId() ? -1 : 1;
}
- return 1;
+ return $aTime < $bTime ? -1 : 1;
});
$result[] = $tmp2;
}
diff --git a/lib/public/Share/IShare.php b/lib/public/Share/IShare.php
index b4d66614cee..12b807400ff 100644
--- a/lib/public/Share/IShare.php
+++ b/lib/public/Share/IShare.php
@@ -550,7 +550,7 @@ interface IShare {
* This is mainly for public shares. It will signal that the share page should
* hide download buttons etc.
*
- * @param bool $ro
+ * @param bool $hide
* @return IShare
* @since 15.0.0
*/