mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2025-01-03 14:32:40 +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:
|
Bug fixes:
|
||||||
- Use icons specified in Atom feeds when available
|
- Use icons specified in Atom feeds when available
|
||||||
|
- Do not return null as subscription unread count
|
||||||
|
|
||||||
Changes:
|
Changes:
|
||||||
- Explicitly forbid U+003A COLON in usernames, for compatibility with HTTP
|
- Explicitly forbid U+003A COLON in usernames, for compatibility with HTTP
|
||||||
|
|
|
@ -748,13 +748,20 @@ class Database {
|
||||||
i.url as favicon,
|
i.url as favicon,
|
||||||
t.top as top_folder,
|
t.top as top_folder,
|
||||||
coalesce(s.title, f.title) as title,
|
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
|
FROM arsse_subscriptions as s
|
||||||
left join topmost as t on t.f_id = s.folder
|
left join topmost as t on t.f_id = s.folder
|
||||||
join arsse_feeds as f on f.id = s.feed
|
join arsse_feeds as f on f.id = s.feed
|
||||||
left join arsse_icons as i on i.id = f.icon
|
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 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]);
|
$q->setWhere("s.owner = ?", ["str"], [$user]);
|
||||||
$nocase = $this->db->sqlToken("nocase");
|
$nocase = $this->db->sqlToken("nocase");
|
||||||
|
|
|
@ -21,8 +21,9 @@ trait SeriesSubscription {
|
||||||
'num' => 'int',
|
'num' => 'int',
|
||||||
],
|
],
|
||||||
'rows' => [
|
'rows' => [
|
||||||
["jane.doe@example.com", "",1],
|
["jane.doe@example.com", "", 1],
|
||||||
["john.doe@example.com", "",2],
|
["john.doe@example.com", "", 2],
|
||||||
|
["jill.doe@example.com", "", 3]
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_folders' => [
|
'arsse_folders' => [
|
||||||
|
@ -81,6 +82,7 @@ trait SeriesSubscription {
|
||||||
[1,"john.doe@example.com",2,null,null,1,2],
|
[1,"john.doe@example.com",2,null,null,1,2],
|
||||||
[2,"jane.doe@example.com",2,null,null,0,0],
|
[2,"jane.doe@example.com",2,null,null,0,0],
|
||||||
[3,"john.doe@example.com",3,"Ook",2,0,1],
|
[3,"john.doe@example.com",3,"Ook",2,0,1],
|
||||||
|
[4,"jill.doe@example.com",2,null,null,0,0],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_tags' => [
|
'arsse_tags' => [
|
||||||
|
@ -291,6 +293,19 @@ trait SeriesSubscription {
|
||||||
$this->assertResult($exp, Arsse::$db->subscriptionList($this->user));
|
$this->assertResult($exp, Arsse::$db->subscriptionList($this->user));
|
||||||
$this->assertArraySubset($exp[0], Arsse::$db->subscriptionPropertiesGet($this->user, 1));
|
$this->assertArraySubset($exp[0], Arsse::$db->subscriptionPropertiesGet($this->user, 1));
|
||||||
$this->assertArraySubset($exp[1], Arsse::$db->subscriptionPropertiesGet($this->user, 3));
|
$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 {
|
public function testListSubscriptionsInAFolder(): void {
|
||||||
|
|
Loading…
Reference in a new issue