mirror of
https://github.com/discourse/discourse.git
synced 2025-06-03 19:39:30 +08:00
DEV: Add framework for filtered plugin registers (#9763)
* DEV: Add framework for filtered plugin registers Plugins often need to add values to a list, and we need to filter those lists at runtime to ignore values from disabled plugins. This commit provides a re-usable way to do that, which should make it easier to add new registers in future, and also reduce repeated code. Follow-up commits will migrate existing registers to use this new system * DEV: Migrate user and group custom field APIs to plugin registry This gives us a consistent system for checking plugin enabled state, so we are repeating less logic. API changes are backwards compatible
This commit is contained in:
@ -1851,8 +1851,7 @@ describe UsersController do
|
||||
end
|
||||
|
||||
after do
|
||||
User.plugin_editable_user_custom_fields.clear
|
||||
User.plugin_staff_editable_user_custom_fields.clear
|
||||
DiscoursePluginRegistry.reset!
|
||||
end
|
||||
|
||||
it "only updates allowed user fields" do
|
||||
@ -1903,8 +1902,7 @@ describe UsersController do
|
||||
end
|
||||
|
||||
it "is secure when there are no registered editable fields" do
|
||||
User.plugin_editable_user_custom_fields.clear
|
||||
User.plugin_staff_editable_user_custom_fields.clear
|
||||
DiscoursePluginRegistry.reset!
|
||||
put "/u/#{user.username}.json", params: { custom_fields: { test1: :hello1, test2: :hello2, test3: :hello3 } }
|
||||
expect(response.status).to eq(200)
|
||||
expect(user.custom_fields["test1"]).to be_blank
|
||||
|
Reference in New Issue
Block a user