From b7e392c7a372a99781fd882ce22a81010500f287 Mon Sep 17 00:00:00 2001 From: tms Date: Sat, 16 Feb 2013 16:46:20 -0500 Subject: [PATCH] Don't count bookmark stats for users who can't see them --- app/models/user_action.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/models/user_action.rb b/app/models/user_action.rb index 6d56f07f1f5..1ae9a929e26 100644 --- a/app/models/user_action.rb +++ b/app/models/user_action.rb @@ -44,10 +44,14 @@ class UserAction < ActiveRecord::Base .where(user_id: user_id) .group('action_type') - # should push this into the sql at some point, but its simple enough for now + # We apply similar filters in stream, might consider trying to consolidate somehow unless guardian.can_see_private_messages?(user_id) results = results.where('topics.archetype <> ?', Archetype::private_message) end + + unless guardian.user && guardian.user.id == user_id + results = results.where("action_type <> ?", BOOKMARK) + end results = results.to_a