mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: allow plugins to extend Groups (#14216)
* add_permitted_group_param API for plugins * add groups-interaction-custom-options outlet * custom search can use custom group scope
This commit is contained in:
committed by
GitHub
parent
9873a942e3
commit
f859fd6bde
@@ -920,6 +920,7 @@ describe Group do
|
||||
|
||||
describe '.search_groups' do
|
||||
fab!(:group) { Fabricate(:group, name: 'tEsT_more_things', full_name: 'Abc something awesome') }
|
||||
let(:messageable_group) { Fabricate(:group, name: "MessageableGroup", messageable_level: Group::ALIAS_LEVELS[:everyone]) }
|
||||
|
||||
it 'should return the right groups' do
|
||||
group
|
||||
@@ -934,6 +935,18 @@ describe Group do
|
||||
expect(Group.search_groups('sOmEthi')).to eq([group])
|
||||
expect(Group.search_groups('test2')).to eq([])
|
||||
end
|
||||
|
||||
it 'allows to filter with additional scope' do
|
||||
messageable_group
|
||||
|
||||
expect(Group.search_groups('es', custom_scope: { name: :messageable, arguments: [user] }).sort).to eq([messageable_group, group].sort)
|
||||
|
||||
plugin = Plugin::Instance.new
|
||||
plugin.register_group_scope_for_search(:messageable)
|
||||
expect(Group.search_groups('es', custom_scope: { name: :messageable, arguments: [user] }).sort).to eq([messageable_group].sort)
|
||||
|
||||
DiscoursePluginRegistry.reset!
|
||||
end
|
||||
end
|
||||
|
||||
describe '#bulk_add' do
|
||||
|
||||
Reference in New Issue
Block a user