[WIP] Enable custom emoji on account pages and in the sidebar (#6124)
Federate custom emojis with accounts
This commit is contained in:
parent
f464f98fd3
commit
123a343d11
10 changed files with 158 additions and 5 deletions
|
@ -51,9 +51,14 @@ class Formatter
|
|||
strip_tags(text)
|
||||
end
|
||||
|
||||
def simplified_format(account)
|
||||
return reformat(account.note).html_safe unless account.local? # rubocop:disable Rails/OutputSafety
|
||||
linkify(account.note)
|
||||
def simplified_format(account, **options)
|
||||
html = if account.local?
|
||||
linkify(account.note)
|
||||
else
|
||||
reformat(account.note)
|
||||
end
|
||||
html = encode_custom_emojis(html, CustomEmoji.from_text(account.note, account.domain)) if options[:custom_emojify]
|
||||
html.html_safe # rubocop:disable Rails/OutputSafety
|
||||
end
|
||||
|
||||
def sanitize(html, config)
|
||||
|
|
|
@ -26,6 +26,9 @@ class OStatus::AtomSerializer
|
|||
append_element(author, 'link', nil, rel: :alternate, type: 'text/html', href: ::TagManager.instance.url_for(account))
|
||||
append_element(author, 'link', nil, rel: :avatar, type: account.avatar_content_type, 'media:width': 120, 'media:height': 120, href: full_asset_url(account.avatar.url(:original))) if account.avatar?
|
||||
append_element(author, 'link', nil, rel: :header, type: account.header_content_type, 'media:width': 700, 'media:height': 335, href: full_asset_url(account.header.url(:original))) if account.header?
|
||||
account.emojis.each do |emoji|
|
||||
append_element(author, 'link', nil, rel: :emoji, href: full_asset_url(emoji.image.url), name: emoji.shortcode)
|
||||
end
|
||||
append_element(author, 'poco:preferredUsername', account.username)
|
||||
append_element(author, 'poco:displayName', account.display_name) if account.display_name?
|
||||
append_element(author, 'poco:note', account.local? ? account.note : strip_tags(account.note)) if account.note?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue