myexperiment-hackers
[Top][All Lists]
Advanced

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

[myexperiment-hackers] [1953] branches/event_logging/app/controllers/hom


From: noreply
Subject: [myexperiment-hackers] [1953] branches/event_logging/app/controllers/home_controller.rb: Subscriptions.
Date: Wed, 12 Nov 2008 15:45:21 -0500 (EST)

Revision
1953
Author
alekses6
Date
2008-11-12 15:45:20 -0500 (Wed, 12 Nov 2008)

Log Message

Subscriptions. Performance improvement for updated items RSS on a "home" page.

Modified Paths

Diff

Modified: branches/event_logging/app/controllers/home_controller.rb (1952 => 1953)


--- branches/event_logging/app/controllers/home_controller.rb	2008-11-12 20:44:16 UTC (rev 1952)
+++ branches/event_logging/app/controllers/home_controller.rb	2008-11-12 20:45:20 UTC (rev 1953)
@@ -34,13 +34,16 @@
 protected
 
   def find_latest_public_updated_items
-    @updated_items_rss = []
-    items = Contribution.last_updated(LATEST_UPDATED_ITEMS_RSS_ENTRY_COUNT)
-    items.each do |item|
-      # should be authorized for anonymous users to view
-      # (feed partials require contributables, not contributions to display details)
-      c_utable = item.contributable
-      @updated_items_rss << c_utable if c_utable.authorized?("show", nil)
+    # Only carry out if request is for RSS
+    if params[:format] and params[:format].downcase == 'rss'
+      @updated_items_rss = []
+      items = Contribution.last_updated(LATEST_UPDATED_ITEMS_RSS_ENTRY_COUNT)
+      items.each do |item|
+        # should be authorized for anonymous users to view
+        # (feed partials require contributables, not contributions to display details)
+        c_utable = item.contributable
+        @updated_items_rss << c_utable if c_utable.authorized?("show", nil)
+      end
     end
   end
   

reply via email to

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