diff options
| author | 2024-12-15 12:34:18 +0100 | |
|---|---|---|
| committer | 2024-12-15 12:34:18 +0100 | |
| commit | 6b14a743ccfe5c14e15acac858c0906f4fccdf67 (patch) | |
| tree | 0a464e2cd74e2ca6a2cdcb0161a2c100c596acbc /app/Models/EntryDAO.php | |
| parent | 066d92be3216cd5d3427072cbc410c19bf53f400 (diff) | |
New state: favorite or unread (#7088)
* New state: favorite or unread
https://github.com/FreshRSS/FreshRSS/discussions/7078#discussioncomment-11526292
* Experiment using this state by default
* Rework state
* Allow ANDS for typos
* Revert change unrelated to this PR
* Revert change of default state
* Add option *unread_or_favorite*
* Fix hide_read_feeds
* i18n: it
Co-authored-by: UserRoot-Luca <55756898+UserRoot-Luca@users.noreply.github.com>
* Update app/i18n/pl/conf.php
Co-authored-by: Zic <55097497+ZicPL@users.noreply.github.com>
* Update app/i18n/pl/conf.php
Co-authored-by: Zic <55097497+ZicPL@users.noreply.github.com>
* Fix i18n
* Fix auto_remove_article
* Fix mark_unread_enabled
---------
Co-authored-by: UserRoot-Luca <55756898+UserRoot-Luca@users.noreply.github.com>
Co-authored-by: Zic <55097497+ZicPL@users.noreply.github.com>
Diffstat (limited to 'app/Models/EntryDAO.php')
| -rw-r--r-- | app/Models/EntryDAO.php | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index 23874a8e1..f9bf57220 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -1112,19 +1112,34 @@ SQL; string $order = 'DESC', string $firstId = '', int $date_min = 0): array { $search = ' '; $values = []; - if ($state & FreshRSS_Entry::STATE_NOT_READ) { - if (!($state & FreshRSS_Entry::STATE_READ)) { - $search .= 'AND ' . $alias . 'is_read=0 '; + if ($state & FreshRSS_Entry::STATE_ANDS) { + if ($state & FreshRSS_Entry::STATE_NOT_READ) { + if (!($state & FreshRSS_Entry::STATE_READ)) { + $search .= 'AND (' . $alias . 'is_read=0) '; + } + } elseif ($state & FreshRSS_Entry::STATE_READ) { + $search .= 'AND (' . $alias . 'is_read=1) '; + } + if ($state & FreshRSS_Entry::STATE_FAVORITE) { + if (!($state & FreshRSS_Entry::STATE_NOT_FAVORITE)) { + $search .= 'AND (' . $alias . 'is_favorite=1) '; + } + } elseif ($state & FreshRSS_Entry::STATE_NOT_FAVORITE) { + $search .= 'AND (' . $alias . 'is_favorite=0) '; } - } elseif ($state & FreshRSS_Entry::STATE_READ) { - $search .= 'AND ' . $alias . 'is_read=1 '; } - if ($state & FreshRSS_Entry::STATE_FAVORITE) { - if (!($state & FreshRSS_Entry::STATE_NOT_FAVORITE)) { - $search .= 'AND ' . $alias . 'is_favorite=1 '; + if ($state & FreshRSS_Entry::STATE_ORS) { + if (trim($search) === '') { + $search = 'AND (1=0) '; + } + if ($state & FreshRSS_Entry::STATE_OR_NOT_READ) { + $search = rtrim($search, ') '); + $search .= ' OR ' . $alias . 'is_read=0) '; + } + if ($state & FreshRSS_Entry::STATE_OR_FAVORITE) { + $search = rtrim($search, ') '); + $search .= ' OR ' . $alias . 'is_favorite=1) '; } - } elseif ($state & FreshRSS_Entry::STATE_NOT_FAVORITE) { - $search .= 'AND ' . $alias . 'is_favorite=0 '; } switch ($order) { |
