about summary refs log tree commit diff
path: root/app/lib
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-11-07 01:14:12 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-11-07 01:14:12 +0100
commit23fc424b7aea139a0aff5cd347f46c81e50c2c56 (patch)
tree47ce5106180cac5ebe93adaa4c91edc2c5ce8b79 /app/lib
parentb835f4aa1ce12cc31a721750a857d8d08a50069a (diff)
Account notes (bios) can now contain links. Character limit upped to 160
Diffstat (limited to 'app/lib')
-rw-r--r--app/lib/formatter.rb15
1 files changed, 12 insertions, 3 deletions
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