Browse Source

Tweak catchupFeed

microsub
J. King 7 years ago
parent
commit
f22fe8ba95
  1. 8
      lib/REST/TinyTinyRSS/API.php
  2. 4
      tests/REST/TinyTinyRSS/TestTinyTinyAPI.php

8
lib/REST/TinyTinyRSS/API.php

@ -65,7 +65,7 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
'feed_url' => ValueInfo::T_STRING | ValueInfo::M_STRICT,
'login' => ValueInfo::T_STRING | ValueInfo::M_STRICT,
'feed_id' => ValueInfo::T_INT,
'article_id' => ValueInfo::T_INT,
'article_id' => ValueInfo::T_MIXED, // single integer or comma-separated list in getArticle
'label_id' => ValueInfo::T_INT,
'article_ids' => ValueInfo::T_STRING,
'assign' => ValueInfo::T_BOOL | ValueInfo::M_DROP,
@ -891,11 +891,7 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
$list = array_column(Arsse::$db->labelList(Arsse::$user->id, false)->getAll(), "id");
// perform marking for each label
foreach ($list as $id) {
try {
Arsse::$db->articleMark(Arsse::$user->id, ['read' => true], (new Context)->label($id));
} catch (ExceptionInput $e) {
// ignore errors
}
Arsse::$db->articleMark(Arsse::$user->id, ['read' => true], (new Context)->label($id));
}
$tr->commit();
} catch (ExceptionInput $e) {

4
tests/REST/TinyTinyRSS/TestTinyTinyAPI.php

@ -905,7 +905,7 @@ class TestTinyTinyAPI extends Test\AbstractTest {
['op' => "catchupFeed", 'sid' => "PriestsOfSyrinx", 'feed_id' => -2, 'is_cat' => true],
];
$in4 = [
// this one has a tricky time-based context and will be handled last
// this one has a tricky time-based context
['op' => "catchupFeed", 'sid' => "PriestsOfSyrinx", 'feed_id' => -3],
];
Phake::when(Arsse::$db)->articleMark->thenThrow(new ExceptionInput("typeViolation"));
@ -926,7 +926,7 @@ class TestTinyTinyAPI extends Test\AbstractTest {
Phake::verify(Arsse::$db)->articleMark($this->anything(), ['read' => true], (new Context)->folder(42));
// reset the database mock
$this->setUp();
Phake::when(Arsse::$db)->articleMark->thenThrow(new ExceptionInput("typeViolation"));
Phake::when(Arsse::$db)->articleMark->thenReturn(42);
Phake::when(Arsse::$db)->subscriptionList($this->anything())->thenReturn(new Result($this->subscriptions));
Phake::when(Arsse::$db)->labelList->thenReturn(new Result($this->labels));
Phake::when(Arsse::$db)->labelList($this->anything(), false)->thenReturn(new Result($this->usedLabels));

Loading…
Cancel
Save