From 8ae3740d5fefab94a5435c93f63c2f189553bb36 Mon Sep 17 00:00:00 2001 From: "J. King" Date: Tue, 15 Dec 2020 19:28:51 -0500 Subject: [PATCH] Implement querying articles by hidden mark --- lib/Database.php | 2 ++ tests/cases/Database/SeriesArticle.php | 30 +++++++++++++++----------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/lib/Database.php b/lib/Database.php index 30a126f..466a036 100644 --- a/lib/Database.php +++ b/lib/Database.php @@ -1312,6 +1312,7 @@ class Database { 'folder' => "coalesce(arsse_subscriptions.folder,0)", 'subscription' => "arsse_subscriptions.id", 'feed' => "arsse_subscriptions.feed", + 'hidden' => "coalesce(arsse_marks.hidden,0)", 'starred' => "coalesce(arsse_marks.starred,0)", 'unread' => "abs(coalesce(arsse_marks.read,0) - 1)", 'note' => "coalesce(arsse_marks.note,'')", @@ -1417,6 +1418,7 @@ class Database { "subscriptions" => ["subscription", "in", "int", ""], "unread" => ["unread", "=", "bool", ""], "starred" => ["starred", "=", "bool", ""], + "hidden" => ["hidden", "=", "bool", ""], ]; foreach ($options as $m => [$col, $op, $type, $pair]) { if (!$context->$m()) { diff --git a/tests/cases/Database/SeriesArticle.php b/tests/cases/Database/SeriesArticle.php index 4edd8c8..a930cae 100644 --- a/tests/cases/Database/SeriesArticle.php +++ b/tests/cases/Database/SeriesArticle.php @@ -235,21 +235,23 @@ trait SeriesArticle { 'starred' => "bool", 'modified' => "datetime", 'note' => "str", + 'hidden' => "bool", ], 'rows' => [ - [1, 1,1,1,'2000-01-01 00:00:00',''], - [5, 19,1,0,'2016-01-01 00:00:00',''], - [5, 20,0,1,'2005-01-01 00:00:00',''], - [7, 20,1,0,'2010-01-01 00:00:00',''], - [8, 102,1,0,'2000-01-02 02:00:00','Note 2'], - [9, 103,0,1,'2000-01-03 03:00:00','Note 3'], - [9, 104,1,1,'2000-01-04 04:00:00','Note 4'], - [10,105,0,0,'2000-01-05 05:00:00',''], - [11, 19,0,0,'2017-01-01 00:00:00','ook'], - [11, 20,1,0,'2017-01-01 00:00:00','eek'], - [12, 3,0,1,'2017-01-01 00:00:00','ack'], - [12, 4,1,1,'2017-01-01 00:00:00','ach'], - [1, 2,0,0,'2010-01-01 00:00:00','Some Note'], + [1, 1,1,1,'2000-01-01 00:00:00','',0], + [5, 19,1,0,'2016-01-01 00:00:00','',0], + [5, 20,0,1,'2005-01-01 00:00:00','',0], + [7, 20,1,0,'2010-01-01 00:00:00','',0], + [8, 102,1,0,'2000-01-02 02:00:00','Note 2',0], + [9, 103,0,1,'2000-01-03 03:00:00','Note 3',0], + [9, 104,1,1,'2000-01-04 04:00:00','Note 4',0], + [10,105,0,0,'2000-01-05 05:00:00','',0], + [11, 19,0,0,'2017-01-01 00:00:00','ook',0], + [11, 20,1,0,'2017-01-01 00:00:00','eek',0], + [12, 3,0,1,'2017-01-01 00:00:00','ack',0], + [12, 4,1,1,'2017-01-01 00:00:00','ach',0], + [1, 2,0,0,'2010-01-01 00:00:00','Some Note',0], + [3, 5,0,0,'2000-01-01 00:00:00','',1], ], ], 'arsse_categories' => [ // author-supplied categories @@ -443,6 +445,8 @@ trait SeriesArticle { 'Starred and Read in subscription' => [(new Context)->starred(true)->unread(false)->subscription(5), []], 'Annotated' => [(new Context)->annotated(true), [2]], 'Not annotated' => [(new Context)->annotated(false), [1,3,4,5,6,7,8,19,20]], + 'Hidden' => [(new Context)->hidden(true), [5]], + 'Not hidden' => [(new Context)->hidden(false), [1,2,3,4,6,7,8,19,20]], 'Labelled' => [(new Context)->labelled(true), [1,5,8,19,20]], 'Not labelled' => [(new Context)->labelled(false), [2,3,4,6,7]], 'Not after edition 999' => [(new Context)->subscription(5)->latestEdition(999), [19]],