diff options
| author | 2022-11-20 08:50:27 -0500 | |
|---|---|---|
| committer | 2022-11-20 14:50:27 +0100 | |
| commit | 02b906549edee298e1986efd2b25e28dda726e89 (patch) | |
| tree | 88c3d28bf03dfde28ea2ed489228caffbcbd4317 /app | |
| parent | 77c214c83c487f59193ccc7d4cc0e3fb0ac0621d (diff) | |
Fix feed ordering (#4841)
Before, the feeds were not ordered every time there was a change in the category
feed list. This behavior was causing discrepancies in the displayed list.
Now, the feeds are ordered every time there is a change in the category feed list.
See #4790
Diffstat (limited to 'app')
| -rw-r--r-- | app/Models/Category.php | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/app/Models/Category.php b/app/Models/Category.php index c4ca12fd3..b33bec26e 100644 --- a/app/Models/Category.php +++ b/app/Models/Category.php @@ -103,9 +103,7 @@ class FreshRSS_Category extends Minz_Model { $this->hasFeedsWithError |= $feed->inError(); } - usort($this->feeds, function ($a, $b) { - return strnatcasecmp($a->name(), $b->name()); - }); + $this->sortFeeds(); } return $this->feeds; @@ -144,6 +142,7 @@ class FreshRSS_Category extends Minz_Model { } $this->feeds = $values; + $this->sortFeeds(); } /** @@ -155,6 +154,8 @@ class FreshRSS_Category extends Minz_Model { $this->feeds = []; } $this->feeds[] = $feed; + + $this->sortFeeds(); } public function _attributes($key, $value) { @@ -245,4 +246,10 @@ class FreshRSS_Category extends Minz_Model { return $ok; } + + private function sortFeeds() { + usort($this->feeds, static function ($a, $b) { + return strnatcasecmp($a->name(), $b->name()); + }); + } } |
