mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: in:tracking and in:watching search filters
This commit is contained in:
@@ -171,6 +171,12 @@ class Search
|
||||
elsif word == 'in:posted'
|
||||
@posted_only = true
|
||||
nil
|
||||
elsif word == 'in:watching'
|
||||
@notification_level = TopicUser.notification_levels[:watching]
|
||||
nil
|
||||
elsif word == 'in:tracking'
|
||||
@notification_level = TopicUser.notification_levels[:tracking]
|
||||
nil
|
||||
else
|
||||
word
|
||||
end
|
||||
@@ -306,6 +312,14 @@ class Search
|
||||
posts = posts.where("posts.user_id = #{@guardian.user.id}")
|
||||
end
|
||||
|
||||
if @notification_level
|
||||
posts = posts.where("posts.topic_id IN (
|
||||
SELECT tu.topic_id FROM topic_users tu
|
||||
WHERE tu.user_id = #{@guardian.user.id} AND
|
||||
tu.notification_level >= #{@notification_level}
|
||||
)")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# If we have a search context, prioritize those posts first
|
||||
|
||||
Reference in New Issue
Block a user