-
-
Notifications
You must be signed in to change notification settings - Fork 756
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix api properties and typo #1791
Conversation
@@ -122,11 +122,11 @@ public function postEntriesAction(Request $request) | |||
$this->get('wallabag_core.content_proxy')->assignTagsToEntry($entry, $tags); | |||
} | |||
|
|||
if (true === (bool) $isStarred) { | |||
if ($isStarred === 'true') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if user send starred=1
or starred=0
?
And I think we should better use 0/1 instead of true false as a string. It'll a lot easier.
And we should check about retrieving entries to apply the same policy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case, we should also change values retrieved to 0/1, what do you think ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep
Le 16 mars 2016 à 19:29, Thomas Citharel notifications@github.com a écrit :
In src/Wallabag/ApiBundle/Controller/WallabagRestController.php:
@@ -122,11 +122,11 @@ public function postEntriesAction(Request $request)
$this->get('wallabag_core.content_proxy')->assignTagsToEntry($entry, $tags);
}
if (true === (bool) $isStarred) {
In that case, we should also change values retrieved to 0/1, what do you think ?if ($isStarred === 'true') {
—
You are receiving this because you were assigned.
Reply to this email directly or view it on GitHub
OK, then we'll have to change the docs. |
718a168
to
dcedb5f
Compare
'star' => true, | ||
'archive' => false, | ||
'starred' => '1', | ||
'archive' => '0', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add extra tests with value like 'starred' => 1, 'archive' => 0,
without single quotes to check the behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
72995e7
to
0cd0d6e
Compare
if (true === (bool) $isArchived) { | ||
$entry->setArchived(true); | ||
if (!is_null($isArchived)) { | ||
$entry->setArchived((bool) $isArchived); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put them this way because you can update an entry with starred/archived at false by adding it again (#1797)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Yeah, because a (bool) string is always true...
Also, cs.