mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Include uncategorized pinned topics on 'Hot'
This commit is contained in:
@@ -27,6 +27,14 @@ class TopicQuery
|
||||
END DESC"
|
||||
end
|
||||
|
||||
def order_hotness
|
||||
"CASE
|
||||
WHEN (COALESCE(topics.pinned_at, '#{lowest_date}') > COALESCE(tu.cleared_pinned_at, '#{lowest_date}'))
|
||||
THEN 100
|
||||
ELSE hot_topics.score + (COALESCE(categories.hotness, 5.0) / 11.0)
|
||||
END DESC"
|
||||
end
|
||||
|
||||
# If you've clearned the pin, use bumped_at, otherwise put it at the top
|
||||
def order_nocategory_with_pinned_sql
|
||||
"CASE
|
||||
@@ -125,7 +133,7 @@ class TopicQuery
|
||||
return_list(unordered: true) do |list|
|
||||
# Find hot topics
|
||||
list = list.joins(:hot_topic)
|
||||
.order('hot_topics.score + (COALESCE(categories.hotness, 5.0) / 11.0) desc')
|
||||
.order(TopicQuery.order_hotness)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user