diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2017-11-30 04:06:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-30 04:06:20 +0100 |
commit | 4c6b5dbe96b565d3db3cbf0912f3b9911bc3922a (patch) | |
tree | 29e04db6b7f9f6caa9e4c76c30414a8dbcae7ec4 /app/lib/formatter.rb | |
parent | 85e97ecab6db67faefb64557af9b2271d2b23735 (diff) |
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
Diffstat (limited to 'app/lib/formatter.rb')
-rw-r--r-- | app/lib/formatter.rb | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/app/lib/formatter.rb b/app/lib/formatter.rb index 733a1c4b7..9d8bc52db 100644 --- a/app/lib/formatter.rb +++ b/app/lib/formatter.rb @@ -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) |