Add semi-support for Video/Image objects in ActivityPub (#5848)
* Add semi-support for Video/Image objects in ActivityPub Video and Image objects will create corresponding status records with manually crafted text contents (title + URL) * Extract html-url-finding logic into JsonLdHelper * Fallback to id when url missing, extract supported object types
This commit is contained in:
@ -51,12 +51,7 @@ class Formatter
|
||||
|
||||
def simplified_format(account)
|
||||
return reformat(account.note).html_safe unless account.local? # rubocop:disable Rails/OutputSafety
|
||||
|
||||
html = encode_and_link_urls(account.note)
|
||||
html = simple_format(html, {}, sanitize: false)
|
||||
html = html.delete("\n")
|
||||
|
||||
html.html_safe # rubocop:disable Rails/OutputSafety
|
||||
linkify(account.note)
|
||||
end
|
||||
|
||||
def sanitize(html, config)
|
||||
@ -69,6 +64,14 @@ class Formatter
|
||||
html.html_safe # rubocop:disable Rails/OutputSafety
|
||||
end
|
||||
|
||||
def linkify(text)
|
||||
html = encode_and_link_urls(text)
|
||||
html = simple_format(html, {}, sanitize: false)
|
||||
html = html.delete("\n")
|
||||
|
||||
html.html_safe # rubocop:disable Rails/OutputSafety
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def encode(html)
|
||||
|
Reference in New Issue
Block a user