Fever API - Fix Mark all as read for feed unread

Zero is a valid super group id according to the "mark the Kindling super group
as read" example in the Fever API docs. But the php function empty considers 0
as an empty value and the condition is never true.

The condition has been changed to accept -1 for the "Sparks" super group,
0 for the "Kindling" super group and any other positive integer (feed and
item id must be positive integers).

The group id Zero is used by Reeder for iOS for the virtual feed "unread".
This commit is contained in:
Mathias Kresin 2014-11-06 19:54:12 +01:00
parent 5a6cc4708a
commit b5b5e91bb0
1 changed files with 2 additions and 1 deletions

View File

@ -302,7 +302,8 @@ foreach (array_keys($_GET) as $action) {
route($action);
}
if (! empty($_POST['mark']) && ! empty($_POST['as']) && ! empty($_POST['id'])) {
if (! empty($_POST['mark']) && ! empty($_POST['as'])
&& ! is_null(filter_input(INPUT_POST, 'id', FILTER_VALIDATE_INT, array('options' => array('default' => NULL,'min_range' => -1)))) ){
if ($_POST['mark'] === 'item') {
route('write_items');