mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: search by user id or category id
FIX: more search results work if you open in new tab FIX: carry context to full page search
This commit is contained in:
@@ -214,12 +214,12 @@ class Search
|
||||
end
|
||||
|
||||
advanced_filter(/category:(.+)/) do |posts,match|
|
||||
category_id = Category.find_by('name ilike ?', match).try(:id)
|
||||
category_id = Category.find_by('name ilike ? OR id = ?', match, match.to_i).try(:id)
|
||||
posts.where("topics.category_id = ?", category_id)
|
||||
end
|
||||
|
||||
advanced_filter(/user:(.+)/) do |posts,match|
|
||||
user_id = User.find_by('username_lower = ?', match.downcase).try(:id)
|
||||
user_id = User.find_by('username_lower = ? OR id = ?', match.downcase, match.to_i).try(:id)
|
||||
posts.where("posts.user_id = #{user_id}")
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user