mirror of
https://github.com/iv-org/invidious.git
synced 2026-08-02 20:09:54 +05:30
fix: fix comments html rendering (#5862)
Now the structure no longer has an array of author thumbnails, is a
single URL:
```json
"author": {
"channelId": "UCiLGHgWdQvfl1G8BPgcO55w",
"displayName": "@uber_nerd-l7r",
"avatarThumbnailUrl": "https://yt3.ggpht.com/ee1_iFgiBvgKHUr3r0_qUVqUpGKhDZaePYq8Q4tIsyVS9L1oRHHJLcHtXrSxyS63AmvldKicbw=s88-c-k-c0x00ffffff-no-rj",
"isVerified": false,
"isCurrentUser": false,
"isCreator": false,
```
This commit is contained in:
@@ -155,17 +155,7 @@ module Invidious::Comments
|
||||
json.field "authorUrl", "/channel/#{comment_author["channelId"].as_s}"
|
||||
json.field "author", comment_author["displayName"].as_s
|
||||
json.field "verified", comment_author["isVerified"].as_bool
|
||||
json.field "authorThumbnails" do
|
||||
json.array do
|
||||
comment_mutation.dig?("payload", "commentEntityPayload", "avatar", "image", "sources").try &.as_a.each do |thumbnail|
|
||||
json.object do
|
||||
json.field "url", thumbnail["url"]
|
||||
json.field "width", thumbnail["width"]
|
||||
json.field "height", thumbnail["height"]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
json.field "authorThumbnail", comment_author["avatarThumbnailUrl"].as_s
|
||||
|
||||
json.field "authorIsChannelOwner", comment_author["isCreator"].as_bool
|
||||
json.field "isSponsor", (comment_author["sponsorBadgeUrl"]? != nil)
|
||||
|
||||
@@ -44,7 +44,7 @@ module Invidious::Frontend::Comments
|
||||
end
|
||||
|
||||
if !thin_mode
|
||||
author_thumbnail = "/ggpht#{URI.parse(child["authorThumbnails"][-1]["url"].as_s).request_target}"
|
||||
author_thumbnail = "/ggpht#{URI.parse(child["authorThumbnail"].as_s).request_target}"
|
||||
else
|
||||
author_thumbnail = ""
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user