about summary refs log tree commit diff
path: root/app/helpers
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-03-21 10:08:19 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-03-21 10:08:19 +0100
commit19a259915eedcdff8c1e82f3b99a6249010b4b30 (patch)
treede0f543aa5dcfdb7aa40831e337b27c1a4e9f5e4 /app/helpers
parent2ba6537f524dfcdd761edbe72f925c26588b4f0e (diff)
Security update
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/atom_builder_helper.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/app/helpers/atom_builder_helper.rb b/app/helpers/atom_builder_helper.rb
index 40d1119c9..da3a1a9b8 100644
--- a/app/helpers/atom_builder_helper.rb
+++ b/app/helpers/atom_builder_helper.rb
@@ -126,9 +126,9 @@ module AtomBuilderHelper
   end
 
   def link_avatar(xml, account)
-    xml.link('rel' => 'avatar', 'type' => account.avatar_content_type, 'media:width' => '300', 'media:height' =>'300', 'href' => asset_url(account.avatar.url(:large, false)))
-    xml.link('rel' => 'avatar', 'type' => account.avatar_content_type, 'media:width' => '96', 'media:height' =>'96', 'href' => asset_url(account.avatar.url(:medium, false)))
-    xml.link('rel' => 'avatar', 'type' => account.avatar_content_type, 'media:width' => '48', 'media:height' =>'48', 'href' => asset_url(account.avatar.url(:small, false)))
+    single_link_avatar(xml, account, :large,  300)
+    single_link_avatar(xml, account, :medium, 96)
+    single_link_avatar(xml, account, :small,  48)
   end
 
   def logo(xml, url)
@@ -207,4 +207,8 @@ module AtomBuilderHelper
   def root_tag(xml, tag, &block)
     xml.send(tag, { :xmlns => 'http://www.w3.org/2005/Atom', 'xmlns:thr' => 'http://purl.org/syndication/thread/1.0', 'xmlns:activity' => 'http://activitystrea.ms/spec/1.0/', 'xmlns:poco' => 'http://portablecontacts.net/spec/1.0', 'xmlns:media' => 'http://purl.org/syndication/atommedia' }, &block)
   end
+
+  def single_link_avatar(xml, account, size, px)
+    xml.link('rel' => 'avatar', 'type' => account.avatar_content_type, 'media:width' => px, 'media:height' =>px, 'href' => asset_url(account.avatar.url(size, false)))
+  end
 end