myexperiment-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myexperiment-hackers] [3551] trunk/app: added fixes for feeds


From: noreply
Subject: [myexperiment-hackers] [3551] trunk/app: added fixes for feeds
Date: Mon, 20 May 2013 14:02:00 +0000 (UTC)

Revision
3551
Author
dgc
Date
2013-05-20 14:01:59 +0000 (Mon, 20 May 2013)

Log Message

added fixes for feeds

Modified Paths

Diff

Modified: trunk/app/helpers/activities_helper.rb (3550 => 3551)


--- trunk/app/helpers/activities_helper.rb	2013-05-20 13:47:37 UTC (rev 3550)
+++ trunk/app/helpers/activities_helper.rb	2013-05-20 14:01:59 UTC (rev 3551)
@@ -151,6 +151,8 @@
 
   def activity_text_summary(text, opts = {})
 
+    return "" if text.nil?
+
     tokens = HTML::Tokenizer.new(CGI::unescapeHTML(text))
 
     result = ""
@@ -253,7 +255,7 @@
     when "Permission create"
       "#{activity_link(activity, :subject)} shared #{activity_link(activity, :auth)}"
     when "FeedItem create"
-      link_to(h(activity.objekt.title), activity.objekt.link, :rel => "nofollow")
+      link_to(strip_tags(activity.objekt.title), activity.objekt.link, :rel => "nofollow")
     when "GroupAnnouncement create"
       activity_link(activity, :object)
     end
@@ -294,7 +296,8 @@
 
     case activity.objekt ? "#{activity.objekt_type} #{activity.action}" : activity.action
     when "FeedItem create"
-      "<div class='extra'>#{image_tag("feed_gray.png", :size => "10x10", :alt_text => "Original atom feed for this news item")} Content via #{link_to(h(activity.objekt.feed.uri), activity.objekt.feed.uri)}</div>"
+      feed = activity.objekt.feed
+      "<div class='extra'>#{image_tag("feed_gray.png", :size => "10x10", :alt_text => "Original atom feed for this news item")} Content via #{link_to(h(feed.title ? feed.title : feed.uri), activity.objekt.feed.uri)}</div>"
     end
   end
 end

Modified: trunk/app/models/feed.rb (3550 => 3551)


--- trunk/app/models/feed.rb	2013-05-20 13:47:37 UTC (rev 3550)
+++ trunk/app/models/feed.rb	2013-05-20 14:01:59 UTC (rev 3551)
@@ -34,6 +34,10 @@
 
         result = SimpleRSS.parse(c.body_str)
 
+        title = result.send(:title)
+
+        update_attribute(:title, title) if title
+
         result.feed.items.each do |item|
 
           # Obtain a unique identifier for use within the context of this feed.

Modified: trunk/app/views/activities/feed.atom.erb (3550 => 3551)


--- trunk/app/views/activities/feed.atom.erb	2013-05-20 13:47:37 UTC (rev 3550)
+++ trunk/app/views/activities/feed.atom.erb	2013-05-20 14:01:59 UTC (rev 3551)
@@ -8,7 +8,7 @@
   <entry>
     <published><%= entry[0].timestamp.to_datetime.rfc3339 -%></published>
     <title><%= strip_tags(activity_title(entry)) -%></title>
-    <content type="html"><%= strip_tags(activity_description(entry, :min_chars => 800)) -%></content>
+    <content type="html"><%= CGI::escapeHTML(strip_tags(activity_description(entry, :min_chars => 800))) -%></content>
     <link type="text/html" rel="alternate" href="" @resource -%>"/>
     <id>urn:uuid:<%= entry[0].uuid -%></id>
     <author>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]