Refactored code and added badges to Search but many dummies because of the way components/item works

This commit is contained in:
jonas-w
2022-02-04 19:59:07 +01:00
parent a2578ac6b4
commit 00df3e2c40
10 changed files with 69 additions and 30 deletions

View File

@@ -144,8 +144,8 @@ def fetch_youtube_comments(id, cursor, format, locale, thin_mode, region, sort_b
content_html = node_comment["contentText"]?.try { |t| parse_content(t) } || ""
author = node_comment["authorText"]?.try &.["simpleText"]? || ""
verified = node_comment["authorCommentBadge"]? != nil
json.field "verified", verified
verified = (node_comment["authorCommentBadge"]? != nil)
json.field "verified", (verified || false)
json.field "author", author
json.field "authorThumbnails" do
json.array do
@@ -329,7 +329,7 @@ def template_youtube_comments(comments, locale, thin_mode, is_replies = false)
end
author_name = HTML.escape(child["author"].as_s)
if child["verified"].as_bool
if child["verified"]?.try &.as_bool
author_name += "<i class=\"icon ion ion-md-checkmark-circle\"></i>"
end
html << <<-END_HTML