mirror of
https://github.com/meineerde/redmine.git
synced 2026-01-02 13:49:42 +00:00
Add a warning if two plugins have the same settings partial name (#14008).
git-svn-id: http://svn.redmine.org/redmine/trunk@13336 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
efc05bc73c
commit
1617ee7bd8
@ -50,6 +50,8 @@ module Redmine #:nodoc:
|
||||
self.public_directory = File.join(Rails.root, 'public', 'plugin_assets')
|
||||
|
||||
@registered_plugins = {}
|
||||
@used_partials = {}
|
||||
|
||||
class << self
|
||||
attr_reader :registered_plugins
|
||||
private :new
|
||||
@ -93,6 +95,15 @@ module Redmine #:nodoc:
|
||||
ActiveSupport::Dependencies.autoload_paths += [dir]
|
||||
end
|
||||
|
||||
# Warn for potential settings[:partial] collisions
|
||||
if p.configurable?
|
||||
partial = p.settings[:partial]
|
||||
if @used_partials[partial]
|
||||
Rails.logger.warn "WARNING: settings partial '#{partial}' is declared in '#{p.id}' plugin but it is already used by plugin '#{@used_partials[partial]}'. Only one settings view will be used. You may want to contact those plugins authors to fix this."
|
||||
end
|
||||
@used_partials[partial] = p.id
|
||||
end
|
||||
|
||||
registered_plugins[id] = p
|
||||
end
|
||||
|
||||
|
||||
@ -173,4 +173,10 @@ class Redmine::PluginTest < ActiveSupport::TestCase
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def test_settings_warns_about_possible_partial_collision
|
||||
@klass.register(:foo) { settings :partial => 'foo/settings' }
|
||||
Rails.logger.expects(:warn)
|
||||
@klass.register(:bar) { settings :partial => 'foo/settings' }
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user