mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-04-02 10:09:51 -04:00
Don't count bookmark stats for users who can't see them
This commit is contained in:
parent
b91ac45359
commit
b7e392c7a3
1 changed files with 5 additions and 1 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue