FIX: most liked queries were leaking info in user summaries
This commit is contained in:
parent
be057dfb75
commit
26f25fc0d9
|
@ -129,7 +129,7 @@ class Topic < ActiveRecord::Base
|
|||
# Return private message topics
|
||||
scope :private_messages, -> { where(archetype: Archetype.private_message) }
|
||||
|
||||
scope :listable_topics, -> { where('topics.archetype <> ?', [Archetype.private_message]) }
|
||||
scope :listable_topics, -> { where('topics.archetype <> ?', Archetype.private_message) }
|
||||
|
||||
scope :by_newest, -> { order('topics.created_at desc, topics.id desc') }
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ class UserSummary
|
|||
def most_liked_by_users
|
||||
likers = {}
|
||||
UserAction.joins(:target_topic, :target_post)
|
||||
.where('topics.archetype <> ?', Archetype.private_message)
|
||||
.merge(Topic.listable_topics.visible.secured(@guardian))
|
||||
.where(user: @user)
|
||||
.where(action_type: UserAction::WAS_LIKED)
|
||||
.group(:acting_user_id)
|
||||
|
@ -78,7 +78,7 @@ class UserSummary
|
|||
def most_liked_users
|
||||
liked_users = {}
|
||||
UserAction.joins(:target_topic, :target_post)
|
||||
.where('topics.archetype <> ?', Archetype.private_message)
|
||||
.merge(Topic.listable_topics.visible.secured(@guardian))
|
||||
.where(action_type: UserAction::WAS_LIKED)
|
||||
.where(acting_user_id: @user.id)
|
||||
.group(:user_id)
|
||||
|
|
Loading…
Reference in New Issue