Issue 11425: Additional sorting by creation date

This commit is contained in:
Michael
2022-04-20 21:03:33 +00:00
parent e1a8f8aff6
commit 2236e5cfb0
5 changed files with 81 additions and 44 deletions

View File

@@ -1162,6 +1162,8 @@ class Conversation
usort($parents, [$this, 'sortThrReceived']);
} elseif (stristr($order, 'commented')) {
usort($parents, [$this, 'sortThrCommented']);
} elseif (stristr($order, 'created')) {
usort($parents, [$this, 'sortThrCreated']);
}
/*
@@ -1266,4 +1268,16 @@ class Conversation
{
return strcmp($b['commented'], $a['commented']);
}
/**
* usort() callback to sort item arrays by the created key
*
* @param array $a
* @param array $b
* @return int
*/
private function sortThrCreated(array $a, array $b)
{
return strcmp($b['created'], $a['created']);
}
}