FIX: sort topics/posts/links in descending order in user summaries

This should only change the order on freshly imported instances with no likes.
This makes the user summary show the latest topics/posts/links instead of the firsts until the users get some likes.
This commit is contained in:
Régis Hanol 2019-01-16 23:58:46 +01:00
parent f0999f27a7
commit 58008dd2fe
1 changed files with 3 additions and 3 deletions

View File

@ -18,7 +18,7 @@ class UserSummary
.listable_topics
.visible
.where(user: @user)
.order('like_count DESC, created_at ASC')
.order('like_count DESC, created_at DESC')
.limit(MAX_SUMMARY_RESULTS)
end
@ -30,7 +30,7 @@ class UserSummary
.merge(Topic.listable_topics.visible.secured(@guardian))
.where(user: @user)
.where('post_number > 1')
.order('posts.like_count DESC, posts.created_at ASC')
.order('posts.like_count DESC, posts.created_at DESC')
.limit(MAX_SUMMARY_RESULTS)
end
@ -42,7 +42,7 @@ class UserSummary
.merge(Topic.listable_topics.visible.secured(@guardian))
.where(user: @user)
.where(internal: false, reflection: false, quote: false)
.order('clicks DESC, topic_links.created_at ASC')
.order('clicks DESC, topic_links.created_at DESC')
.limit(MAX_SUMMARY_RESULTS)
end