1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-23 06:44:57 +00:00

Address more bugs with deleted subs

This commit is contained in:
J. King 2023-02-25 22:58:09 -05:00
parent 9c83b7ec18
commit d1876773e8
2 changed files with 20 additions and 2 deletions

View file

@ -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();

View file

@ -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");