FIX: Add plugin event to topic list user lookup (#14116)

This can be used to change the list of topic posters. For example,
discourse-solved can use this to move the user who posted the solution
after the original poster.
This commit is contained in:
Bianca Nenciu
2021-08-25 13:16:08 +03:00
committed by GitHub
parent 5ae700e731
commit 197532dc31
3 changed files with 26 additions and 2 deletions

View File

@ -210,6 +210,16 @@ class Plugin::Instance
TopicView.add_custom_filter(trigger, &block)
end
# Allows to add more user IDs to the list of preloaded users. This can be
# useful to efficiently change the list of posters or participants.
# Example usage:
# register_topic_list_preload_user_ids do |topics, user_ids, topic_list|
# user_ids << Discourse::SYSTEM_USER_ID
# end
def register_topic_list_preload_user_ids(&block)
TopicList.on_preload_user_ids(&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|