aboutsummaryrefslogtreecommitdiff
path: root/app/Models/Category.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Models/Category.php')
-rw-r--r--app/Models/Category.php13
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());
+ });
+ }
}