mirror of
https://github.com/iv-org/invidious.git
synced 2026-08-17 13:30:53 -05:00
fix(comments): render custom channel emojis in comments and descriptions (closes #5888)
This commit is contained in:
parent
eb407578a2
commit
b313d2cf71
@ -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
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user