Add emoji reactions bar in embedded status

This commit is contained in:
KMY 2023-04-04 16:12:37 +09:00
parent 9cee344e99
commit 67bee91eed
5 changed files with 35 additions and 4 deletions

View file

@ -62,7 +62,12 @@ class EmojiFormatter
private
def emoji_map
@emoji_map ||= custom_emojis.each_with_object({}) { |e, h| h[e.shortcode] = [full_asset_url(e.image.url), full_asset_url(e.image.url(:static))] }
# from emoji_reactions_grouped_by_name (status_stat)
if !custom_emojis.first&.image.present?
return @emoji_map ||= custom_emojis.each_with_object({}) { |e, h| h[e.name] = [e.url, e.static_url] }
end
return @emoji_map ||= custom_emojis.each_with_object({}) { |e, h| h[e.shortcode] = [full_asset_url(e.image.url), full_asset_url(e.image.url(:static))] }
end
def count_tag_nesting(tag)
@ -85,7 +90,7 @@ class EmojiFormatter
end
def image_attributes
{ rel: 'emoji', draggable: false, width: 16, height: 16, class: image_class_names, style: image_style }
{ rel: 'emoji', draggable: false, height: 16, class: image_class_names, style: image_style }
end
def image_data_attributes(original_url, static_url)
@ -97,7 +102,7 @@ class EmojiFormatter
end
def image_style
@options[:style]
'min-width:16px;' + (@options[:style] || '')
end
def animate?