rsnext/examples/blog-with-comment/lib
Oiva Eskola c78b249c66
Fix falsy values not being returned in post fields (#29011)
I imported a bunch of old markdown posts to the blog-starter example but some of the post metadata was not returned by the API in the example code.

For example, having `published: false` in post metadata was not returned in the item fields.

The problem was in check:
```
if (data[field]) {
  items[field] = data[field]
}
```
This rejects all falsy values in addition to fields that are not set. Checking only for `undefined` should fix this issue.

I didn't find existing integration tests for the blog example nor an issue describing this problem.



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2021-09-11 14:24:24 +00:00
..
createComment.js Example blog with comments (#24829) 2021-06-10 21:04:33 -05:00
dateRelative.js Example blog with comments (#24829) 2021-06-10 21:04:33 -05:00
deleteComment.js Example blog with comments (#24829) 2021-06-10 21:04:33 -05:00
fetchComment.js Example blog with comments (#24829) 2021-06-10 21:04:33 -05:00
getPost.js Fix falsy values not being returned in post fields (#29011) 2021-09-11 14:24:24 +00:00
getUser.js Example blog with comments (#24829) 2021-06-10 21:04:33 -05:00
markdownToHtml.js Example blog with comments (#24829) 2021-06-10 21:04:33 -05:00
redis.js Example blog with comments (#24829) 2021-06-10 21:04:33 -05:00