mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
FEATURE: show pinned topics for TL0 on top/year page
BUGFIX: word-wrap on topic-excerpt
This commit is contained in:
@ -15,6 +15,10 @@ module TopicQuerySQL
|
||||
"3000-01-01"
|
||||
end
|
||||
|
||||
def order_by_category_sql(dir)
|
||||
"CASE WHEN categories.id = #{SiteSetting.uncategorized_category_id.to_i} THEN '' ELSE categories.name END #{dir}"
|
||||
end
|
||||
|
||||
# If you've clearned the pin, use bumped_at, otherwise put it at the top
|
||||
def order_with_pinned_sql
|
||||
"CASE
|
||||
@ -24,10 +28,6 @@ module TopicQuerySQL
|
||||
END DESC"
|
||||
end
|
||||
|
||||
def order_by_category_sql(dir)
|
||||
"CASE WHEN categories.id = #{SiteSetting.uncategorized_category_id.to_i} THEN '' ELSE categories.name END #{dir}"
|
||||
end
|
||||
|
||||
# If you've clearned the pin, use bumped_at, otherwise put it at the top
|
||||
def order_nocategory_with_pinned_sql
|
||||
"CASE
|
||||
@ -37,14 +37,24 @@ module TopicQuerySQL
|
||||
END DESC"
|
||||
end
|
||||
|
||||
# For anonymous users
|
||||
def order_nocategory_basic_bumped
|
||||
"CASE WHEN topics.category_id = #{SiteSetting.uncategorized_category_id.to_i} and (topics.pinned_at IS NOT NULL) THEN 0 ELSE 1 END, topics.bumped_at DESC"
|
||||
end
|
||||
|
||||
def order_basic_bumped
|
||||
"CASE WHEN (topics.pinned_at IS NOT NULL) THEN 0 ELSE 1 END, topics.bumped_at DESC"
|
||||
end
|
||||
|
||||
def order_nocategory_basic_bumped
|
||||
"CASE WHEN topics.category_id = #{SiteSetting.uncategorized_category_id.to_i} and (topics.pinned_at IS NOT NULL) THEN 0 ELSE 1 END, topics.bumped_at DESC"
|
||||
end
|
||||
|
||||
def order_top_for(score)
|
||||
"top_topics.#{score} DESC, topics.bumped_at DESC"
|
||||
end
|
||||
|
||||
def order_top_with_pinned_category_for(score)
|
||||
# display pinned topics first
|
||||
"CASE WHEN COALESCE(topics.pinned_at, '#{lowest_date}') > COALESCE(tu.cleared_pinned_at, '#{lowest_date}') THEN 1 ELSE 0 END DESC,
|
||||
top_topics.#{score} DESC,
|
||||
topics.bumped_at DESC"
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user