diff options
| author | 2019-10-31 12:33:18 +0100 | |
|---|---|---|
| committer | 2019-10-31 12:33:18 +0100 | |
| commit | 4058898de2006cb4ee3b4565bd3e0235b4d0f0d9 (patch) | |
| tree | ba42967a7612b0b6c31a3b20caecc88097dee96a | |
| parent | 00b0f76ef4c5733e6caa3d62d739354c1db15c63 (diff) | |
Fix categories sorting (#2616)
I had a bug when some articles in a category were unread. Sometimes,
filtering the category displayed all the articles, even with the "Adjust
showing" option.
A reasonably good guess was to look the last commits that impacted the
categories and, indeed, it was introduced by the new category sorting
system.
The sort function (`usort`) doesn't keep the index association, which is
important here. I must admit I don't understand exactly why (I didn't
search), but the keys are probably used somewhere. Another fix would be
to not rely on these keys anymore.
The bug was introduced in 042fcd5e93884690efdd2f957ca02751958c0724
- Ref PR: https://github.com/FreshRSS/FreshRSS/pull/2592
- Ref usort: https://www.php.net/manual/en/function.usort.php
- Ref uasort: https://www.php.net/manual/en/function.uasort.php
| -rw-r--r-- | app/Models/CategoryDAO.php | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/Models/CategoryDAO.php b/app/Models/CategoryDAO.php index a0eda89e7..c1277751c 100644 --- a/app/Models/CategoryDAO.php +++ b/app/Models/CategoryDAO.php @@ -208,7 +208,7 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo implements FreshRSS_Searchable return $categories; } - usort($categories, function ($a, $b) { + uasort($categories, function ($a, $b) { $aPosition = $a->attributes('position'); $bPosition = $b->attributes('position'); if ($aPosition === $bPosition) { |
