Modified: branches/event_logging/app/helpers/application_helper.rb (1904 => 1905)
--- branches/event_logging/app/helpers/application_helper.rb 2008-10-30 12:21:36 UTC (rev 1904)
+++ branches/event_logging/app/helpers/application_helper.rb 2008-10-30 14:17:35 UTC (rev 1905)
@@ -1501,7 +1501,7 @@
rtn = []
news_item = nil # contributor_news_from_log!() will return NIL if event is not to be added to the feed for the current user
events.each do |e|
- news_item = contributor_news_from_log!(e, current_viewer)
+ news_item = contributor_news_from_log!(e, current_viewer, contributor, contributor_news_only)
rtn << news_item unless news_item.nil?
# no need to interpret more events than is required by the method call;
@@ -1519,7 +1519,7 @@
# NIL is returned when the user viewing the news is not authorized to see
# current news entry OR entry in the event log is no longer valid because of
# some of the referenced objects missing (perhaps, they were deleted over time)
- def contributor_news_from_log!(log_entry, current_viewer)
+ def contributor_news_from_log!(log_entry, current_viewer, contributor, contributor_news_only)
rtn = [] # despite this, NIL will be returned on errors / when news entry not to be shown for current user
action = ""
loggable_type = log_entry.activity_loggable_type
@@ -1643,6 +1643,11 @@
when "request"
rtn << [timestamp, "#{name(user)} requested to join the #{title(network)} Group."]
when "accept"
+ # even though it can be the admin who accepted the membership request,
+ # news item says that the "user" has joined the group - so it's not
+ # acceptable to show this event on the group admin's profile page
+ return nil if (contributor_news_only && contributor.id == network_admin.id)
+
rtn << [timestamp, "#{name(user)} joined the #{title(network)} Group."]
when "reject"
if log_entry.culprit_type == "User"
@@ -1996,7 +2001,7 @@
# as these are created / deleted along with the user account
when "update"
# only friends of the user will see this event
- if my_event || current_viewer.friend?(log_entry.culprit_id)
+ if my_event || (logged_in? && current_viewer.friend?(log_entry.culprit_id))
rtn << [timestamp, "#{culprit_link} has updated their #{link_to "profile", user_path(log_entry.culprit_id)}"]
end
end