mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 04:51:17 +08:00
FEATURE: ability to register custom filters for posts (#12938)
Allow plugins to extend TopicView to filter posts
This commit is contained in:

committed by
GitHub

parent
f337d59ed9
commit
a4bd1806d9
@ -208,6 +208,14 @@ class Plugin::Instance
|
||||
Search.advanced_filter(trigger, &block)
|
||||
end
|
||||
|
||||
# Allows to define TopicView posts filters. Example usage:
|
||||
# TopicView.advanced_filter do |posts, opts|
|
||||
# posts.where(wiki: true)
|
||||
# end
|
||||
def register_topic_view_posts_filter(trigger, &block)
|
||||
TopicView.add_custom_filter(trigger, &block)
|
||||
end
|
||||
|
||||
# Allow to eager load additional tables in Search. Useful to avoid N+1 performance problems.
|
||||
# Example usage:
|
||||
# register_search_topic_eager_load do |opts|
|
||||
|
Reference in New Issue
Block a user