Modified: branches/event_logging/app/helpers/application_helper.rb (1883 => 1884)
--- branches/event_logging/app/helpers/application_helper.rb 2008-10-23 12:31:57 UTC (rev 1883)
+++ branches/event_logging/app/helpers/application_helper.rb 2008-10-24 10:42:22 UTC (rev 1884)
@@ -1453,6 +1453,18 @@
# and subsequent sorting will be required anyway)
events = ActivityLog.find(:all, :conditions => ["created_at > ? AND created_at < ? AND ((activity_loggable_type = ? AND activity_loggable_id = ?) OR (culprit_type = ? AND culprit_id = ?) OR (referenced_type = ? AND referenced_id = ?))", after, before, contributor.class.to_s, contributor.id, contributor.class.to_s, contributor.id, contributor.class.to_s, contributor.id])
+
+ # 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!!
+ if contributor.class.to_s.downcase == "user"
+ contributor.networks_owned.each do |network|
+ events_as_admin = ActivityLog.find(:all, :conditions => ["created_at > ? AND created_at < ? AND (culprit_type = ? AND culprit_id = ?)", after, before, network.class.to_s, network.id])
+ events.concat(events_as_admin)
+ end
+ end
+
+
# if any "related_contributors", get events for each
# (can't use the "limit" parameter just yet, because events for "related_contributors" may be newer
# than some of the contributor in the original query)