From 123a343d116d3e83cbd04460cc7bd0b6f3d208c4 Mon Sep 17 00:00:00 2001 From: David Underwood Date: Sun, 1 Apr 2018 17:55:42 -0400 Subject: [WIP] Enable custom emoji on account pages and in the sidebar (#6124) Federate custom emojis with accounts --- app/lib/formatter.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'app/lib/formatter.rb') diff --git a/app/lib/formatter.rb b/app/lib/formatter.rb index 1df4ff8d4..f7e7a3c23 100644 --- a/app/lib/formatter.rb +++ b/app/lib/formatter.rb @@ -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) -- cgit