Modified: branches/event_logging/app/helpers/application_helper.rb (2029 => 2030)
--- branches/event_logging/app/helpers/application_helper.rb 2008-12-03 13:22:41 UTC (rev 2029)
+++ branches/event_logging/app/helpers/application_helper.rb 2008-12-03 14:55:06 UTC (rev 2030)
@@ -1524,7 +1524,9 @@
# (NIL will yield news entries interpreting ALL events in ["after".."before"] timeframe)
# 8) current_viewer - User instance, who is currently requests news to be generated
# (zero or NIL for anonymous user - that is for public news feed: like for RSS feeds, etc)
- def news_from_log_for_contributor(contributor, before, after, contributor_news_only, contributor_initiated_actions_only, return_raw_events, limit, current_viewer)
+ # 9) not_recursive_call - indicates that the method wasn't called recursively to fetch e.g. events of "my friend"; some of the actions might not need
+ # to be executed in recursive method calls - so this parameter acts as a switch for these cases
+ def news_from_log_for_contributor(contributor, before, after, contributor_news_only, contributor_initiated_actions_only, return_raw_events, limit, current_viewer, not_recursive_call=true)
# DEBUG
# puts "=================================="
@@ -1556,7 +1558,7 @@
case contributor.class.to_s.downcase
when "user"
- unless contributor_news_only
+ if !contributor_news_only
# ..add friends
related_contributors.concat(contributor.friends)
@@ -1572,7 +1574,7 @@
# remove the contributor from the list of related contributors to avoid double processing
related_contributors.delete(contributor)
- else
+ elsif not_recursive_call
# fetch events initiated by networks (i.e. where network is a culprit) belonging to contributor;
# NB! this works on assumption that networks have only one admin -> therefore, events initiated by
# the network are the ones done by contributor as he's the admin!!
@@ -1620,7 +1622,7 @@
# than some of the contributor in the original query)
events_for_related_contributor = []
related_contributors.each do |c|
- events_for_related_contributor = news_from_log_for_contributor(c, before, after, true, false, true, limit, current_viewer)
+ events_for_related_contributor = news_from_log_for_contributor(c, before, after, true, false, true, limit, current_viewer, false)
events.concat(events_for_related_contributor)
end
return events if return_raw_events