Merge branch 'kb_development' into kb_migration

This commit is contained in:
KMY 2023-04-04 17:05:24 +09:00
commit 3a088f3c21
7 changed files with 38 additions and 6 deletions

View file

@ -245,4 +245,8 @@ module ApplicationHelper
def prerender_custom_emojis(html, custom_emojis, other_options = {})
EmojiFormatter.new(html, custom_emojis, other_options.merge(animate: prefers_autoplay?)).to_s
end
def prerender_custom_emojis_from_hash(html, custom_emojis_hash)
prerender_custom_emojis(html, JSON.parse([custom_emojis_hash].to_json, object_class: OpenStruct))
end
end

View file

@ -18,6 +18,10 @@ module FormattingHelper
html_aware_format(status.text, status.local?, preloaded_accounts: [status.account] + (status.respond_to?(:active_mentions) ? status.active_mentions.map(&:account) : []))
end
def emoji_name_format(emoji_reaction, status)
html_aware_format(emoji_reaction['url'].present? ? ":#{emoji_reaction['name']}:" : emoji_reaction['name'], status.local?)
end
def rss_status_content_format(status)
html = status_content_format(status)
@ -45,7 +49,7 @@ module FormattingHelper
prerender_custom_emojis(
safe_join([before_html, html, after_html]),
status.emojis,
style: 'width: 1.1em; height: 1.1em; object-fit: contain; vertical-align: middle; margin: -.2ex .15em .2ex'
style: 'min-width: 1.1em; height: 1.1em; object-fit: contain; vertical-align: middle; margin: -.2ex .15em .2ex'
).to_str
end