mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 13:12:41 +00:00
Exclude hiddens from subscription unread count
Also fix a bug that would result in the unread count being null if no marks existed
This commit is contained in:
parent
97010d8822
commit
8527c83976
3 changed files with 27 additions and 4 deletions
|
@ -3,6 +3,7 @@ Version 0.9.0 (????-??-??)
|
|||
|
||||
Bug fixes:
|
||||
- Use icons specified in Atom feeds when available
|
||||
- Do not return null as subscription unread count
|
||||
|
||||
Changes:
|
||||
- Explicitly forbid U+003A COLON in usernames, for compatibility with HTTP
|
||||
|
|
|
@ -748,13 +748,20 @@ class Database {
|
|||
i.url as favicon,
|
||||
t.top as top_folder,
|
||||
coalesce(s.title, f.title) as title,
|
||||
(articles - marked) as unread
|
||||
coalesce((articles - hidden - marked + hidden_marked), articles) as unread
|
||||
FROM arsse_subscriptions as s
|
||||
left join topmost as t on t.f_id = s.folder
|
||||
join arsse_feeds as f on f.id = s.feed
|
||||
left join arsse_icons as i on i.id = f.icon
|
||||
left join (select feed, count(*) as articles from arsse_articles group by feed) as article_stats on article_stats.feed = s.feed
|
||||
left join (select subscription, sum(\"read\") as marked from arsse_marks group by subscription) as mark_stats on mark_stats.subscription = s.id"
|
||||
left join (
|
||||
select
|
||||
subscription,
|
||||
sum(cast((\"read\" = 1 and hidden = 0) as integer)) as marked,
|
||||
sum(cast((\"read\" = 0 and hidden = 1) as integer)) as hidden,
|
||||
sum(cast((\"read\" = 1 and hidden = 1) as integer)) as hidden_marked
|
||||
from arsse_marks group by subscription
|
||||
) as mark_stats on mark_stats.subscription = s.id"
|
||||
);
|
||||
$q->setWhere("s.owner = ?", ["str"], [$user]);
|
||||
$nocase = $this->db->sqlToken("nocase");
|
||||
|
|
|
@ -21,8 +21,9 @@ trait SeriesSubscription {
|
|||
'num' => 'int',
|
||||
],
|
||||
'rows' => [
|
||||
["jane.doe@example.com", "",1],
|
||||
["john.doe@example.com", "",2],
|
||||
["jane.doe@example.com", "", 1],
|
||||
["john.doe@example.com", "", 2],
|
||||
["jill.doe@example.com", "", 3]
|
||||
],
|
||||
],
|
||||
'arsse_folders' => [
|
||||
|
@ -81,6 +82,7 @@ trait SeriesSubscription {
|
|||
[1,"john.doe@example.com",2,null,null,1,2],
|
||||
[2,"jane.doe@example.com",2,null,null,0,0],
|
||||
[3,"john.doe@example.com",3,"Ook",2,0,1],
|
||||
[4,"jill.doe@example.com",2,null,null,0,0],
|
||||
],
|
||||
],
|
||||
'arsse_tags' => [
|
||||
|
@ -291,6 +293,19 @@ trait SeriesSubscription {
|
|||
$this->assertResult($exp, Arsse::$db->subscriptionList($this->user));
|
||||
$this->assertArraySubset($exp[0], Arsse::$db->subscriptionPropertiesGet($this->user, 1));
|
||||
$this->assertArraySubset($exp[1], Arsse::$db->subscriptionPropertiesGet($this->user, 3));
|
||||
// test that an absence of marks does not corrupt unread count
|
||||
$exp = [
|
||||
[
|
||||
'url' => "http://example.com/feed2",
|
||||
'title' => "eek",
|
||||
'folder' => null,
|
||||
'top_folder' => null,
|
||||
'unread' => 5,
|
||||
'pinned' => 0,
|
||||
'order_type' => 0,
|
||||
],
|
||||
];
|
||||
$this->assertResult($exp, Arsse::$db->subscriptionList("jill.doe@example.com"));
|
||||
}
|
||||
|
||||
public function testListSubscriptionsInAFolder(): void {
|
||||
|
|
Loading…
Reference in a new issue