mirror of
https://github.com/iv-org/invidious.git
synced 2024-11-26 15:37:23 +00:00
Add commentCount for videos with no comments
This commit is contained in:
parent
bdaa8a06fd
commit
7b135a6d0c
@ -1746,7 +1746,7 @@ get "/api/v1/comments/:id" do |env|
|
|||||||
if format == "json"
|
if format == "json"
|
||||||
next {"comments" => [] of String}.to_json
|
next {"comments" => [] of String}.to_json
|
||||||
else
|
else
|
||||||
next {"contentHtml" => ""}.to_json
|
next {"contentHtml" => "", "commentCount" => 0}.to_json
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
ctoken = ctoken["ctoken"]
|
ctoken = ctoken["ctoken"]
|
||||||
@ -1784,7 +1784,7 @@ get "/api/v1/comments/:id" do |env|
|
|||||||
if format == "json"
|
if format == "json"
|
||||||
next {"comments" => [] of String}.to_json
|
next {"comments" => [] of String}.to_json
|
||||||
else
|
else
|
||||||
next {"contentHtml" => ""}.to_json
|
next {"contentHtml" => "", "commentCount" => 0}.to_json
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1920,6 +1920,8 @@ get "/api/v1/comments/:id" do |env|
|
|||||||
|
|
||||||
if comments["commentCount"]?
|
if comments["commentCount"]?
|
||||||
json.field "commentCount", comments["commentCount"]
|
json.field "commentCount", comments["commentCount"]
|
||||||
|
else
|
||||||
|
json.field "commentCount", 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user