about summary refs log tree commit diff
path: root/app/lib
diff options
context:
space:
mode:
authorEugen <eugen@zeonfederated.com>2017-04-22 03:33:24 +0200
committerGitHub <noreply@github.com>2017-04-22 03:33:24 +0200
commit9d3be5579a07bbff182b40cf15c04f762f155e51 (patch)
tree36bce1bb5c16c800814afe3730e9134828d7596c /app/lib
parent05ac28f3e451c9239093f55a32e9f1eda770f8fa (diff)
Improve bio compatibility (#2278)
* Fix #1057 (close #1819) - Move HTML-formatted bio from <poco:note /> to <summary type="html" />

* Ensure <poco:note /> is plaintext for remote accounts, also, by stripping out HTML
Diffstat (limited to 'app/lib')
-rw-r--r--app/lib/atom_serializer.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/lib/atom_serializer.rb b/app/lib/atom_serializer.rb
index 5aeb7b4f9..920eac31b 100644
--- a/app/lib/atom_serializer.rb
+++ b/app/lib/atom_serializer.rb
@@ -2,6 +2,7 @@
 
 class AtomSerializer
   include RoutingHelper
+  include ActionView::Helpers::SanitizeHelper
 
   class << self
     def render(element)
@@ -21,13 +22,13 @@ class AtomSerializer
     append_element(author, 'uri', uri)
     append_element(author, 'name', account.username)
     append_element(author, 'email', account.local? ? account.local_username_and_domain : account.acct)
-    append_element(author, 'summary', account.note)
+    append_element(author, 'summary', Formatter.instance.simplified_format(account).to_str, type: :html) if account.note?
     append_element(author, 'link', nil, rel: :alternate, type: 'text/html', href: TagManager.instance.url_for(account))
     append_element(author, 'link', nil, rel: :avatar, type: account.avatar_content_type, 'media:width': 120, 'media:height': 120, href: full_asset_url(account.avatar.url(:original)))
     append_element(author, 'link', nil, rel: :header, type: account.header_content_type, 'media:width': 700, 'media:height': 335, href: full_asset_url(account.header.url(:original)))
     append_element(author, 'poco:preferredUsername', account.username)
     append_element(author, 'poco:displayName', account.display_name) if account.display_name?
-    append_element(author, 'poco:note', Formatter.instance.simplified_format(account).to_str) if account.note?
+    append_element(author, 'poco:note', account.local? ? account.note : strip_tags(account.note)) if account.note?
     append_element(author, 'mastodon:scope', account.locked? ? :private : :public)
 
     author