mirror of
https://github.com/discourse/discourse.git
synced 2026-08-03 09:53:24 -05:00
DEV: Add order:title filter to experimental /filter route (#22293)
This has been requested multiple times by users so it makes sense for us to support this as well. See https://meta.discourse.org/t/sort-display-of-topics-alphabetically/53911
This commit is contained in:
@@ -490,6 +490,9 @@ class TopicsFilter
|
||||
"posters" => {
|
||||
column: "topics.participant_count",
|
||||
},
|
||||
"title" => {
|
||||
column: "LOWER(topics.title)",
|
||||
},
|
||||
"views" => {
|
||||
column: "topics.views",
|
||||
},
|
||||
@@ -508,7 +511,7 @@ class TopicsFilter
|
||||
@scope = instance_exec(&scope)
|
||||
end
|
||||
|
||||
@scope = @scope.order(column_name => match_data[:asc] ? :asc : :desc)
|
||||
@scope = @scope.order("#{column_name} #{match_data[:asc] ? "ASC" : "DESC"}")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user