diff options
| author | Omar Roth <omarroth@hotmail.com> | 2018-08-17 13:03:25 -0500 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2018-08-17 13:03:25 -0500 |
| commit | 6bb747b579530abf59a9dd651dc2038a540e50b8 (patch) | |
| tree | 2f1d1b61c8b168d5135e84cd51a17b318c80836d /src | |
| parent | 9a15438c71b47bae8a2a88446027258bbc03a88a (diff) | |
| download | invidious-6bb747b579530abf59a9dd651dc2038a540e50b8.tar.gz invidious-6bb747b579530abf59a9dd651dc2038a540e50b8.tar.bz2 invidious-6bb747b579530abf59a9dd651dc2038a540e50b8.zip | |
Fix comment replies
Diffstat (limited to 'src')
| -rw-r--r-- | src/invidious.cr | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/invidious.cr b/src/invidious.cr index e1b3560f..290687e9 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -1842,8 +1842,17 @@ get "/api/v1/comments/:id" do |env| comments = JSON.parse(comments) content_html = template_youtube_comments(comments) - next {"contentHtml" => content_html, - "commentCount" => comments["commentCount"]}.to_json + response = JSON.build do |json| + json.object do + json.field "contentHtml", content_html + + if comments["commentCount"]? + json.field "commentCount", comments["commentCount"] + end + end + end + + next response end elsif source == "reddit" client = make_client(REDDIT_URL) |
