FEATURE: allow moderators to globally pin topics

This commit is contained in:
Sam
2014-04-07 16:38:51 +10:00
parent ae3b2a6e02
commit 0372b81d11
10 changed files with 31 additions and 7 deletions

View File

@ -31,7 +31,7 @@ module TopicQuerySQL
# If you've clearned the pin, use bumped_at, otherwise put it at the top
def order_nocategory_with_pinned_sql
"CASE
WHEN topics.category_id = #{SiteSetting.uncategorized_category_id.to_i} and (COALESCE(topics.pinned_at, '#{lowest_date}') > COALESCE(tu.cleared_pinned_at, '#{lowest_date}'))
WHEN topics.pinned_globally and (COALESCE(topics.pinned_at, '#{lowest_date}') > COALESCE(tu.cleared_pinned_at, '#{lowest_date}'))
THEN '#{highest_date}'
ELSE topics.bumped_at
END DESC"
@ -42,7 +42,7 @@ module TopicQuerySQL
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"
"CASE WHEN topics.pinned_globally and (topics.pinned_at IS NOT NULL) THEN 0 ELSE 1 END, topics.bumped_at DESC"
end
def order_top_for(score)