diff options
| author | 2024-05-02 10:28:07 +0200 | |
|---|---|---|
| committer | 2024-05-02 10:28:07 +0200 | |
| commit | 617f9a7fa63675986daab70b161664f24091291e (patch) | |
| tree | 63f5918734e0012b00fa04ab4472afc320761475 /app/Models/UserQuery.php | |
| parent | cd8fc428cb22825a3fc8e8c1d3d82135567560cd (diff) | |
Fix user query filter display (#6421)
* Fix user query filter display
fix https://github.com/FreshRSS/FreshRSS/issues/6360
* Fix tests
Diffstat (limited to 'app/Models/UserQuery.php')
| -rw-r--r-- | app/Models/UserQuery.php | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/app/Models/UserQuery.php b/app/Models/UserQuery.php index 156b2df4a..6f7996b07 100644 --- a/app/Models/UserQuery.php +++ b/app/Models/UserQuery.php @@ -48,6 +48,8 @@ class FreshRSS_UserQuery { $this->labels = $labels; if (isset($query['get'])) { $this->parseGet($query['get']); + } else { + $this->get_type = 'all'; } if (isset($query['name'])) { $this->name = trim($query['name']); @@ -107,7 +109,9 @@ class FreshRSS_UserQuery { */ private function parseGet(string $get): void { $this->get = $get; - if (preg_match('/(?P<type>[acfistT])(_(?P<id>\d+))?/', $get, $matches)) { + if ($this->get === '') { + $this->get_type = 'all'; + } elseif (preg_match('/(?P<type>[acfistT])(_(?P<id>\d+))?/', $get, $matches)) { $id = intval($matches['id'] ?? '0'); switch ($matches['type']) { case 'a': @@ -155,22 +159,22 @@ class FreshRSS_UserQuery { /** * Check if the user query has parameters. - * If the type is 'all', it is considered equal to no parameters */ public function hasParameters(): bool { - if ($this->get_type === 'all') { - return false; - } - if ($this->hasSearch()) { + if ($this->get_type !== 'all') { return true; } - if ($this->state) { + if ($this->hasSearch()) { return true; } - if ($this->order) { + if (!in_array($this->state, [ + 0, + FreshRSS_Entry::STATE_READ | FreshRSS_Entry::STATE_NOT_READ, + FreshRSS_Entry::STATE_READ | FreshRSS_Entry::STATE_NOT_READ | FreshRSS_Entry::STATE_FAVORITE | FreshRSS_Entry::STATE_NOT_FAVORITE + ], true)) { return true; } - if ($this->get) { + if ($this->order !== '' && $this->order !== FreshRSS_Context::userConf()->sort_order) { return true; } return false; |
