mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Order pinned topics by their pinned_at column (#14090)
Currently, pinned topics are ordered by the `bumped_at` column. This behavior is not desired because it gives admins no control over the order of pinned topics. This PR makes pinned topics ordered by the `pinned_at` column. A topic that is pinned last appears first in topic lists. If an admin wants an already pinned topic to appear first in the list of pinned topics, they'll have to unpin that topic and pin it again. Meta topic: https://meta.discourse.org/t/how-do-i-set-the-order-of-pinned-topics/16935/23?u=osama.
This commit is contained in:
@@ -390,7 +390,7 @@ class TopicQuery
|
||||
end
|
||||
|
||||
unpinned_topics = topics.where("NOT ( #{pinned_clause} )")
|
||||
pinned_topics = topics.dup.offset(nil).where(pinned_clause)
|
||||
pinned_topics = topics.dup.offset(nil).where(pinned_clause).reorder(pinned_at: :desc)
|
||||
|
||||
per_page = options[:per_page] || per_page_setting
|
||||
limit = per_page unless options[:limit] == false
|
||||
|
||||
Reference in New Issue
Block a user