mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: added status:noreplies and status:archived to advanced search
This commit is contained in:
@@ -142,6 +142,7 @@ class Search
|
||||
private
|
||||
|
||||
def process_advanced_search!(term)
|
||||
|
||||
term.to_s.split(/\s+/).map do |word|
|
||||
if word == 'status:open'
|
||||
@status = :open
|
||||
@@ -149,6 +150,12 @@ class Search
|
||||
elsif word == 'status:closed'
|
||||
@status = :closed
|
||||
nil
|
||||
elsif word == 'status:archived'
|
||||
@status = :archived
|
||||
nil
|
||||
elsif word == 'status:noreplies'
|
||||
@no_replies = true
|
||||
nil
|
||||
elsif word == 'order:latest'
|
||||
@order = :latest
|
||||
nil
|
||||
@@ -263,8 +270,14 @@ class Search
|
||||
|
||||
if @status == :open
|
||||
posts = posts.where('NOT topics.closed AND NOT topics.archived')
|
||||
elsif @status == :archived
|
||||
posts = posts.where('topics.archived')
|
||||
elsif @status == :closed
|
||||
posts = posts.where('topics.closed OR topics.archived')
|
||||
posts = posts.where('topics.closed')
|
||||
end
|
||||
|
||||
if @no_replies
|
||||
posts = posts.where("topics.featured_user1_id IS NULL AND topics.last_post_user_id = topics.user_id")
|
||||
end
|
||||
|
||||
# If we have a search context, prioritize those posts first
|
||||
|
||||
Reference in New Issue
Block a user