mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2025-01-18 17:10:33 +00:00
Adjust TTRSS catchupFeed to use shallow subscription listing
This commit is contained in:
parent
cbe82c57cd
commit
fff6082e3c
2 changed files with 9 additions and 7 deletions
|
@ -19,8 +19,9 @@ use JKingWeb\Arsse\REST\Response;
|
||||||
|
|
||||||
Protocol difference so far:
|
Protocol difference so far:
|
||||||
- Handling of incorrect Content-Type and/or HTTP method is different
|
- Handling of incorrect Content-Type and/or HTTP method is different
|
||||||
- TT-RSS accepts whitespace-only names; we do not
|
- TT-RSS accepts whitespace-only names for categories, labels, and feeds; we do not
|
||||||
- TT-RSS allows two folders to share the same name under the same parent; we do not
|
- TT-RSS allows two folders to share the same name under the same parent; we do not
|
||||||
|
- TT-RSS requires the user to choose in the face of multiple found feeds during discovery; we use the first one (picoFeed limitation)
|
||||||
- Session lifetime is much shorter by default
|
- Session lifetime is much shorter by default
|
||||||
- Categories and feeds will always be sorted alphabetically (the protocol does not allow for clients to re-order)
|
- Categories and feeds will always be sorted alphabetically (the protocol does not allow for clients to re-order)
|
||||||
- The "Archived" virtual feed is non-functional (the protocol does not allow archiving)
|
- The "Archived" virtual feed is non-functional (the protocol does not allow archiving)
|
||||||
|
@ -873,14 +874,14 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
try {
|
try {
|
||||||
$tr = Arsse::$db->begin();
|
$tr = Arsse::$db->begin();
|
||||||
// filter the subscription list to return only uncategorized, and get their IDs
|
// filter the subscription list to return only uncategorized, and get their IDs
|
||||||
$list = array_column(array_filter(Arsse::$db->subscriptionList(Arsse::$user->id)->getAll(), function($value) {return is_null($value['folder']);}), "id");
|
$list = array_column(Arsse::$db->subscriptionList(Arsse::$user->id, null, false)->getAll(), "id");
|
||||||
// perform marking for each applicable subscription
|
// perform marking for each applicable subscription
|
||||||
foreach ($list as $id) {
|
foreach ($list as $id) {
|
||||||
Arsse::$db->articleMark(Arsse::$user->id, ['read' => true], (new Context)->subscription($id));
|
Arsse::$db->articleMark(Arsse::$user->id, ['read' => true], (new Context)->subscription($id));
|
||||||
}
|
}
|
||||||
$tr->commit();
|
$tr->commit();
|
||||||
} catch (ExceptionInput $e) {
|
} catch (ExceptionInput $e) { // @codeCoverageIgnore
|
||||||
// ignore errors
|
// ignore errors; none should occur
|
||||||
}
|
}
|
||||||
return $out;
|
return $out;
|
||||||
case self::CAT_LABELS:
|
case self::CAT_LABELS:
|
||||||
|
@ -894,8 +895,8 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
Arsse::$db->articleMark(Arsse::$user->id, ['read' => true], (new Context)->label($id));
|
Arsse::$db->articleMark(Arsse::$user->id, ['read' => true], (new Context)->label($id));
|
||||||
}
|
}
|
||||||
$tr->commit();
|
$tr->commit();
|
||||||
} catch (ExceptionInput $e) {
|
} catch (ExceptionInput $e) { // @codeCoverageIgnore
|
||||||
// ignore errors
|
// ignore errors; none should occur
|
||||||
}
|
}
|
||||||
return $out;
|
return $out;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -927,7 +927,8 @@ class TestTinyTinyAPI extends Test\AbstractTest {
|
||||||
// reset the database mock
|
// reset the database mock
|
||||||
$this->setUp();
|
$this->setUp();
|
||||||
Phake::when(Arsse::$db)->articleMark->thenReturn(42);
|
Phake::when(Arsse::$db)->articleMark->thenReturn(42);
|
||||||
Phake::when(Arsse::$db)->subscriptionList($this->anything())->thenReturn(new Result($this->subscriptions));
|
Phake::when(Arsse::$db)->subscriptionList->thenReturn(new Result($this->subscriptions));
|
||||||
|
Phake::when(Arsse::$db)->subscriptionList($this->anything(), null, false)->thenReturn(new Result(array_filter($this->subscriptions, function($value) {return is_null($value['folder']);})));
|
||||||
Phake::when(Arsse::$db)->labelList->thenReturn(new Result($this->labels));
|
Phake::when(Arsse::$db)->labelList->thenReturn(new Result($this->labels));
|
||||||
Phake::when(Arsse::$db)->labelList($this->anything(), false)->thenReturn(new Result($this->usedLabels));
|
Phake::when(Arsse::$db)->labelList($this->anything(), false)->thenReturn(new Result($this->usedLabels));
|
||||||
// verify the complex contexts
|
// verify the complex contexts
|
||||||
|
|
Loading…
Add table
Reference in a new issue