From 23fc424b7aea139a0aff5cd347f46c81e50c2c56 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Mon, 7 Nov 2016 01:14:12 +0100 Subject: Account notes (bios) can now contain links. Character limit upped to 160 --- app/lib/formatter.rb | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'app/lib') diff --git a/app/lib/formatter.rb b/app/lib/formatter.rb index 1ec77e56d..d7b100649 100644 --- a/app/lib/formatter.rb +++ b/app/lib/formatter.rb @@ -8,7 +8,7 @@ class Formatter include ActionView::Helpers::SanitizeHelper def format(status) - return reformat(status) unless status.local? + return reformat(status.content) unless status.local? html = status.text html = encode(html) @@ -20,8 +20,17 @@ class Formatter html.html_safe end - def reformat(status) - sanitize(status.content, tags: %w(a br p), attributes: %w(href rel)) + def reformat(html) + sanitize(html, tags: %w(a br p), attributes: %w(href rel)) + end + + def simplified_format(account) + return reformat(account.note) unless account.local? + + html = encode(account.note) + html = link_urls(html) + + html.html_safe end private -- cgit