DEV: Added modifier hooks to allow plugins to tweak how categories and groups are fetched (#21837)

This commit adds modifiers that allow plugins to change how categories and groups are prefetched into the application and listed in the respective controllers.

Possible use cases:

- prevent some categories/groups from being prefetched when the application loads for performance reasons.
- prevent some categories/groups from being listed in their respective index pages.
This commit is contained in:
Sérgio Saquetim
2023-05-30 18:41:50 -03:00
committed by GitHub
parent 1e3a5124da
commit 908117e270
8 changed files with 196 additions and 26 deletions

View File

@@ -630,7 +630,7 @@ class Search
Group
.visible_groups(@guardian.user)
.members_visible_groups(@guardian.user)
.where("groups.name ILIKE ? OR (id = ? AND id > 0)", match, match.to_i)
.where("groups.name ILIKE ? OR (groups.id = ? AND groups.id > 0)", match, match.to_i)
DiscoursePluginRegistry.search_groups_set_query_callbacks.each do |cb|
group_query = cb.call(group_query, @term, @guardian)