mirror of
https://github.com/discourse/discourse.git
synced 2025-04-28 01:34:33 +08:00
FIX: don't show links in PM in user summary
This commit is contained in:
parent
125d9b5d2e
commit
7ab521758f
@ -38,9 +38,10 @@ class UserSummary
|
|||||||
|
|
||||||
def links
|
def links
|
||||||
TopicLink
|
TopicLink
|
||||||
|
.joins(:topic, :post)
|
||||||
|
.where('topics.archetype <> ?', Archetype.private_message)
|
||||||
.where(user: @user)
|
.where(user: @user)
|
||||||
.where(internal: false)
|
.where(internal: false, reflection: false, quote: false)
|
||||||
.where(reflection: false)
|
|
||||||
.order('clicks DESC, created_at ASC')
|
.order('clicks DESC, created_at ASC')
|
||||||
.limit(MAX_SUMMARY_RESULTS)
|
.limit(MAX_SUMMARY_RESULTS)
|
||||||
end
|
end
|
||||||
@ -51,17 +52,14 @@ class UserSummary
|
|||||||
|
|
||||||
def most_liked_by_users
|
def most_liked_by_users
|
||||||
likers = {}
|
likers = {}
|
||||||
UserAction.joins("JOIN posts ON posts.id = user_actions.target_post_id")
|
UserAction.joins(:target_topic, :target_post)
|
||||||
.joins("JOIN topics ON topics.id = posts.topic_id")
|
.where('topics.archetype <> ?', Archetype.private_message)
|
||||||
.where("posts.deleted_at IS NULL")
|
|
||||||
.where("topics.deleted_at IS NULL")
|
|
||||||
.where("topics.archetype <> '#{Archetype.private_message}'")
|
|
||||||
.where(user: @user)
|
.where(user: @user)
|
||||||
.where(action_type: UserAction::WAS_LIKED)
|
.where(action_type: UserAction::WAS_LIKED)
|
||||||
.group(:acting_user_id)
|
.group(:acting_user_id)
|
||||||
.order("COUNT(*) DESC")
|
.order('COUNT(*) DESC')
|
||||||
.limit(MAX_SUMMARY_RESULTS)
|
.limit(MAX_SUMMARY_RESULTS)
|
||||||
.pluck("acting_user_id, COUNT(*)")
|
.pluck('acting_user_id, COUNT(*)')
|
||||||
.each { |l| likers[l[0].to_s] = l[1] }
|
.each { |l| likers[l[0].to_s] = l[1] }
|
||||||
|
|
||||||
User.where(id: likers.keys)
|
User.where(id: likers.keys)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user