FEATURE: allow to extend topic_eager_loads in Search (#10625)

This additional interface is required by encrypt plugin
This commit is contained in:
Krzysztof Kotlarek
2020-09-14 11:58:28 +10:00
committed by GitHub
parent 15f7fa801d
commit cb58cbbc2c
3 changed files with 53 additions and 2 deletions

View File

@ -206,6 +206,17 @@ class Plugin::Instance
Search.advanced_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|
# %i(example_table)
# end
# OR
# register_search_topic_eager_load(%i(example_table))
def register_search_topic_eager_load(tables = nil, &block)
Search.custom_topic_eager_load(tables, &block)
end
# Request a new size for topic thumbnails
# Will respect plugin enabled setting is enabled
# Size should be an array with two elements [max_width, max_height]