diff options
| author | 2022-05-15 21:53:13 +0200 | |
|---|---|---|
| committer | 2022-05-15 21:53:13 +0200 | |
| commit | ffd1061850d73182d40126658a0e9dd7f28f646e (patch) | |
| tree | 03c81f09311f82441e427217316746a4963e4600 /app/Models/UserQuery.php | |
| parent | 807ea755e0bddb814f5c55bdfa5321ce144fe816 (diff) | |
User query automatic reconstruct of URL (#4360)
* User query automatic reconstruct of URL
(Invisible through the Web UI, only when working with configuration files manually)
Avoid the requirement of storing user queries with duplicated information (parsed parameters AND the resulting URL):
Before:
```
[
'name' => 'Hello',
'search' => 'Hello OR World',
'state' => '3',
'url' => './?search=Hello+OR+World&state=3',
]
```
After:
```
[
'name' => 'Hello',
'search' => 'Hello OR World',
'state' => '3',
]
```
* Fix test
Diffstat (limited to 'app/Models/UserQuery.php')
| -rw-r--r-- | app/Models/UserQuery.php | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/app/Models/UserQuery.php b/app/Models/UserQuery.php index 7f8aa07ef..236813942 100644 --- a/app/Models/UserQuery.php +++ b/app/Models/UserQuery.php @@ -39,6 +39,14 @@ class FreshRSS_UserQuery { if (isset($query['order'])) { $this->order = $query['order']; } + if (empty($query['url'])) { + if (!empty($query)) { + unset($query['name']); + $this->url = Minz_Url::display(array('params' => $query)); + } + } else { + $this->url = $query['url']; + } if (!isset($query['search'])) { $query['search'] = ''; } @@ -47,9 +55,6 @@ class FreshRSS_UserQuery { if (isset($query['state'])) { $this->state = $query['state']; } - if (isset($query['url'])) { - $this->url = $query['url']; - } } /** |
