FIX: Adding a custom scope should not modify the original ones. (#12178)
Default scopes are stored inside a class variable, which shouldn't be modified when a custom scope is added. If this happens, we're no longer to remove the scope when the plugin is disabled.
This commit is contained in:
parent
9a72876863
commit
e485e95792
|
@ -59,10 +59,11 @@ class ApiKeyScope < ActiveRecord::Base
|
|||
|
||||
def scope_mappings
|
||||
plugin_mappings = DiscoursePluginRegistry.api_key_scope_mappings
|
||||
return default_mappings if plugin_mappings.empty?
|
||||
|
||||
default_mappings.deep_dup.tap do |mappings|
|
||||
|
||||
default_mappings.tap do |mappings|
|
||||
plugin_mappings.each do |resource|
|
||||
|
||||
resource.each_value do |resource_actions|
|
||||
resource_actions.each_value do |action_data|
|
||||
action_data[:urls] = find_urls(action_data[:actions])
|
||||
|
|
Loading…
Reference in New Issue