fix(comments): render custom channel emojis in comments and descriptions (closes #5888)

This commit is contained in:
Test User 2026-08-08 14:46:33 -04:00
parent eb407578a2
commit b313d2cf71

View File

@ -63,22 +63,20 @@ def content_to_comment_html(content, video_id : String? = "")
# check for custom emojis # check for custom emojis
if run["emoji"]? if run["emoji"]?
if run["emoji"]["isCustomEmoji"]?.try &.as_bool if emoji_image = run.dig?("emoji", "image")
if emoji_image = run.dig?("emoji", "image") emoji_alt = emoji_image.dig?("accessibility", "accessibilityData", "label").try &.as_s || text
emoji_alt = emoji_image.dig?("accessibility", "accessibilityData", "label").try &.as_s || text emoji_thumb = emoji_image["thumbnails"][0]
emoji_thumb = emoji_image["thumbnails"][0] text = String.build do |str|
text = String.build do |str| str << %(<img alt=") << emoji_alt << "\" "
str << %(<img alt=") << emoji_alt << "\" " str << %(src="/ggpht) << URI.parse(emoji_thumb["url"].as_s).request_target << "\" "
str << %(src="/ggpht) << URI.parse(emoji_thumb["url"].as_s).request_target << "\" " str << %(title=") << emoji_alt << "\" "
str << %(title=") << emoji_alt << "\" " str << %(width=") << emoji_thumb["width"] << "\" "
str << %(width=") << emoji_thumb["width"] << "\" " str << %(height=") << emoji_thumb["height"] << "\" "
str << %(height=") << emoji_thumb["height"] << "\" " str << %(class="channel-emoji" />)
str << %(class="channel-emoji" />)
end
else
# Hide deleted channel emoji
text = ""
end end
else
# Hide deleted channel emoji
text = ""
end end
end end