Api Bugs on getCategories

Development-related discussion, including bundled plugins
scmaruthi
Bear Rating Trainee
Bear Rating Trainee
Posts: 2
Joined: 29 Apr 2016, 10:27

Api Bugs on getCategories

Postby scmaruthi » 29 Apr 2016, 10:36

There is a problem where getCategories gives out json of incorrect types for ID.

line 159 of api.php to be changed to

Code: Select all

array_push($cats, array("id" => (int)$line["id"],


also change line 175
from

Code: Select all

"unread" => $unread));

to

Code: Select all

"unread" => $unread,
"order_id"=> $cat_id));

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: Api Bugs on getCategories

Postby fox » 29 Apr 2016, 11:36

please use the normal patch submission process via gitlab, thanks

>line 159 of api.php to be changed to

json is untyped

>also change line 175

the change you propose is really strange, care to elaborate?

also, the line numbers in your post are incorrect, you're using old code

scmaruthi
Bear Rating Trainee
Bear Rating Trainee
Posts: 2
Joined: 29 Apr 2016, 10:27

Re: Api Bugs on getCategories

Postby scmaruthi » 30 Apr 2016, 13:36

thanks for your reply

json is untyped

but the result of the output would be for a integer 1 is "1" vs 1.
Parsing the json in a typed language would be easier.

the change you propose is really strange, care to elaborate?

explicitly defining order_id allows the resulting Json to correctly be parsed as a list of same objects.
whereas the old code would result result in two object types
1 containing ordinaryCategories {id,title,unread,order_id}
and the other specialCategories{id,title,unread}

the choice of assigning order_id to cat_id is to maintain the uniqueness of the field.
it could very well be order_id = 0. It's just to make the object same as the others above.

also, the line numbers in your post are incorrect, you're using old code

sorry I'm using the one from https://tt-rss.org/gitlab/fox/tt-rss/bl ... es/api.php and thought it's was the latest.

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: Api Bugs on getCategories

Postby fox » 30 Apr 2016, 15:02

alright i see your point, its just that setting order_id to entry id was strange


Return to “Development”

Who is online

Users browsing this forum: No registered users and 2 guests