mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
DEV: Add plugin_modifier for groups in users_controller#search_users
(#22329)
This commit is contained in:

committed by
GitHub

parent
ed70b16db6
commit
acaea2b5c5
@ -1234,6 +1234,11 @@ class UsersController < ApplicationController
|
||||
groups = block.call(groups, current_user) if params[param_name.to_s]
|
||||
end
|
||||
|
||||
# the plugin registry callbacks above are only evaluated when a param
|
||||
# is present matching the name of the callback. Any modifier registered using
|
||||
# register_modifier(:groups_for_users_search) will be evaluated without needing the
|
||||
# param.
|
||||
groups = DiscoursePluginRegistry.apply_modifier(:groups_for_users_search, groups)
|
||||
groups = Group.search_groups(term, groups: groups, sort: :auto)
|
||||
|
||||
to_render[:groups] = groups.map { |m| { name: m.name, full_name: m.full_name } }
|
||||
|
Reference in New Issue
Block a user