Browse Source

Address more bugs with deleted subs

redup
J. King 1 year ago
parent
commit
d1876773e8
  1. 2
      lib/Database.php
  2. 20
      tests/cases/Database/SeriesArticle.php

2
lib/Database.php

@ -2120,7 +2120,7 @@ class Database {
select arsse_articles.id as article select arsse_articles.id as article
FROM arsse_articles FROM arsse_articles
join arsse_subscriptions on arsse_subscriptions.id = arsse_articles.subscription join arsse_subscriptions on arsse_subscriptions.id = arsse_articles.subscription
WHERE arsse_articles.id = ? and arsse_subscriptions.owner = ? WHERE arsse_articles.id = ? and arsse_subscriptions.owner = ? and arsse_subscriptions.deleted = 0
) as articles left join arsse_editions on arsse_editions.article = articles.article group by articles.article", ) as articles left join arsse_editions on arsse_editions.article = articles.article group by articles.article",
["int", "str"] ["int", "str"]
)->run($id, $user)->getRow(); )->run($id, $user)->getRow();

20
tests/cases/Database/SeriesArticle.php

@ -207,6 +207,8 @@ trait SeriesArticle {
[ 801,801], [ 801,801],
[ 802,802], [ 802,802],
[ 902,802], [ 902,802],
[ 999,999],
[9999,999],
], ],
], ],
'arsse_enclosures' => [ 'arsse_enclosures' => [
@ -531,6 +533,7 @@ trait SeriesArticle {
801 => 801, 801 => 801,
802 => 802, 802 => 802,
902 => 802, 902 => 802,
999 => 999,
1001 => 20, 1001 => 20,
]; ];
$act = Arsse::$db->editionArticle(...range(1, 1001)); $act = Arsse::$db->editionArticle(...range(1, 1001));
@ -742,7 +745,12 @@ trait SeriesArticle {
public function testMarkAMissingSubscription(): void { public function testMarkAMissingSubscription(): void {
$this->assertException("idMissing", "Db", "ExceptionInput"); $this->assertException("idMissing", "Db", "ExceptionInput");
Arsse::$db->articleMark($this->user, ['read' => true], (new Context)->folder(2112)); Arsse::$db->articleMark($this->user, ['read' => true], (new Context)->subscription(1));
}
public function testMarkADeletedSubscription(): void {
$this->assertException("idMissing", "Db", "ExceptionInput");
Arsse::$db->articleMark("john.doe@example.com", ['read' => true], (new Context)->subscription(16));
} }
public function testMarkAnArticle(): void { public function testMarkAnArticle(): void {
@ -783,6 +791,11 @@ trait SeriesArticle {
Arsse::$db->articleMark($this->user, ['starred' => true], (new Context)->article(1)); Arsse::$db->articleMark($this->user, ['starred' => true], (new Context)->article(1));
} }
public function testMarkAnArticleOfADeletedSubscription(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->articleMark("john.doe@example.com", ['starred' => true], (new Context)->article(999));
}
public function testMarkAnEdition(): void { public function testMarkAnEdition(): void {
Arsse::$db->articleMark($this->user, ['starred' => true], (new Context)->edition(1101)); Arsse::$db->articleMark($this->user, ['starred' => true], (new Context)->edition(1101));
$now = Date::transform(time(), "sql"); $now = Date::transform(time(), "sql");
@ -874,6 +887,11 @@ trait SeriesArticle {
Arsse::$db->articleMark($this->user, ['starred' => true], (new Context)->edition(2)); Arsse::$db->articleMark($this->user, ['starred' => true], (new Context)->edition(2));
} }
public function testMarkAnEditionOfADeletedSubscription(): void {
$this->assertException("subjectMissing", "Db", "ExceptionInput");
Arsse::$db->articleMark("john.doe@example.com", ['starred' => true], (new Context)->edition(9999));
}
public function testMarkByOldestEdition(): void { public function testMarkByOldestEdition(): void {
Arsse::$db->articleMark($this->user, ['starred' => true], (new Context)->editionRange(2205, null)); Arsse::$db->articleMark($this->user, ['starred' => true], (new Context)->editionRange(2205, null));
$now = Date::transform(time(), "sql"); $now = Date::transform(time(), "sql");

Loading…
Cancel
Save