diff options
| author | Omar Roth <omarroth@hotmail.com> | 2018-08-30 21:03:22 -0500 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2018-08-30 21:03:22 -0500 |
| commit | 7b135a6d0cd669a3fccb3b42a9012d20c9b09c24 (patch) | |
| tree | 25c825edcc0b7baa354c3ccc46fb68ee315ee676 /src/invidious.cr | |
| parent | bdaa8a06fda18f9895c2fe83cfc8d676b4936a0f (diff) | |
| download | invidious-7b135a6d0cd669a3fccb3b42a9012d20c9b09c24.tar.gz invidious-7b135a6d0cd669a3fccb3b42a9012d20c9b09c24.tar.bz2 invidious-7b135a6d0cd669a3fccb3b42a9012d20c9b09c24.zip | |
Add commentCount for videos with no comments
Diffstat (limited to 'src/invidious.cr')
| -rw-r--r-- | src/invidious.cr | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/invidious.cr b/src/invidious.cr index 16e41d80..3f84cd44 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -1746,7 +1746,7 @@ get "/api/v1/comments/:id" do |env| if format == "json" next {"comments" => [] of String}.to_json else - next {"contentHtml" => ""}.to_json + next {"contentHtml" => "", "commentCount" => 0}.to_json end end ctoken = ctoken["ctoken"] @@ -1784,7 +1784,7 @@ get "/api/v1/comments/:id" do |env| if format == "json" next {"comments" => [] of String}.to_json else - next {"contentHtml" => ""}.to_json + next {"contentHtml" => "", "commentCount" => 0}.to_json end end @@ -1920,6 +1920,8 @@ get "/api/v1/comments/:id" do |env| if comments["commentCount"]? json.field "commentCount", comments["commentCount"] + else + json.field "commentCount", 0 end end end |
