Open davidoskky opened 3 years ago
I do not think it was possible to filter for read
but we can add it here:
Oh, then I am sorry if I have to make you add a new functionality, but I believe it would be really useful.
It is quite simple change:
--- a/src/daos/mysql/Items.php
+++ b/src/daos/mysql/Items.php
@@ -231,16 +231,19 @@ class Items implements \daos\ItemsInterface {
$where = [$stmt::bool(true)];
$order = 'DESC';
- // only starred
- if (isset($options['type']) && $options['type'] === 'starred') {
- $where[] = $stmt::isTrue('starred');
- }
-
- // only unread
- elseif (isset($options['type']) && $options['type'] === 'unread') {
- $where[] = $stmt::isTrue('unread');
- if (\F3::get('unread_order') === 'asc') {
- $order = 'ASC';
+ if (isset($options['type'])) {
+ if ($options['type'] === 'starred') {
+ // only starred
+ $where[] = $stmt::isTrue('starred');
+ } elseif ($options['type'] === 'read') {
+ // only read
+ $where[] = $stmt::isFalse('unread');
+ } elseif ($options['type'] === 'unread') {
+ // only unread
+ $where[] = $stmt::isTrue('unread');
+ if (\F3::get('unread_order') === 'asc') {
+ $order = 'ASC';
+ }
}
}
I tested this, it works exactly as expected, thank you!
I believe it was previously possible to query read items from the api calling /items with the parameter type set to read. Would it be possible to add back this functionality in order to selectively get read items?