]> source.dussan.org Git - redmine.git/commitdiff
Fix RuntimeError on `reload!` in the Rails console (#38155).
authorGo MAEDA <maeda@farend.jp>
Mon, 5 Feb 2024 13:39:02 +0000 (13:39 +0000)
committerGo MAEDA <maeda@farend.jp>
Mon, 5 Feb 2024 13:39:02 +0000 (13:39 +0000)
Patch by Thomas Löber (@tloeber).

git-svn-id: https://svn.redmine.org/redmine/trunk@22681 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redmine/access_control.rb
lib/redmine/asset_path.rb
lib/redmine/menu_manager.rb
lib/redmine/plugin.rb
lib/redmine/scm/base.rb
lib/redmine/wiki_formatting.rb

index 515386e199ef4e2dc8869e1d0ab13e07e2a96fe2..3c1208df61b79e8d4b33ace869e426f5e6518a31 100644 (file)
@@ -84,6 +84,7 @@ module Redmine
 
       def permission(name, hash, options={})
         @permissions ||= []
+        @permissions.reject! {|p| p.name == name}
         options[:project_module] = @project_module
         @permissions << Permission.new(name, hash, options)
       end
index b115fe187160b2fc66315ad50cd75c57b9b2d34c..4284e1971560f5023c6b4e715696f0acbdc8517a 100644 (file)
@@ -202,7 +202,7 @@ module Redmine
       end
     end
 
-    ASSET_URL_PATTERN = /(url\(\s*["']?([^"'\s)]+)\s*["']?\s*\))/
+    ASSET_URL_PATTERN = /(url\(\s*["']?([^"'\s)]+)\s*["']?\s*\))/ unless defined? ASSET_URL_PATTERN
 
     def convert_path(input, conversion)
       input.gsub(ASSET_URL_PATTERN) do |matched|
index 39922b96ca3df4eb7b04177ae12b1cf01a2502d1..66ae6f4884ebcc55bc97f0c17206ae21b14726cb 100644 (file)
@@ -292,6 +292,8 @@ module Redmine
           target_root = @menu_items.root
         end
 
+        target_root.children.reject! {|item| item.name == name}
+
         # menu item position
         if first = options.delete(:first)
           target_root.prepend(MenuItem.new(name, url, options))
@@ -379,8 +381,6 @@ module Redmine
 
       # Adds a child at given position
       def add_at(child, position)
-        raise "Child already added" if find {|node| node.name == child.name}
-
         @children = @children.insert(position, child)
         child.parent = self
         child
index c9b2c07bad22c64848e6183333218f0c14693d89..f0dbcc30daba01b7f0c38df716e15716d9f1e73b 100644 (file)
@@ -125,7 +125,7 @@ module Redmine
       # Warn for potential settings[:partial] collisions
       if p.configurable?
         partial = p.settings[:partial]
-        if @used_partials[partial]
+        if @used_partials[partial] && @used_partials[partial] != p.id
           Rails.logger.warn(
             "WARNING: settings partial '#{partial}' is declared in '#{p.id}' plugin " \
               "but it is already used by plugin '#{@used_partials[partial]}'. " \
index b313754b74f5305d8375432a824b07fb8e7347b5..4f965df4e1017d004fc03d04e24fe1293287ecf9 100644 (file)
@@ -28,6 +28,7 @@ module Redmine
         # Add a new SCM adapter and repository
         def add(scm_name)
           @scms ||= []
+          @scms.delete(scm_name)
           @scms << scm_name
         end
 
index 28b1ea1302ad3bb0e7aaf98a875f1b2dff8c960e..95455417a730322847e6678ff460cd9b5f69281a 100644 (file)
@@ -34,7 +34,6 @@ module Redmine
       def register(name, *args)
         options = args.last.is_a?(Hash) ? args.pop : {}
         name = name.to_s
-        raise ArgumentError, "format name '#{name}' is already taken" if @@formatters[name]
 
         formatter, helper, parser =
           if args.any?
@@ -44,12 +43,16 @@ module Redmine
           end
         raise "A formatter class is required" if formatter.nil?
 
-        @@formatters[name] = {
+        entry = {
           :formatter => formatter,
           :helper => helper,
           :html_parser => parser,
           :label => options[:label] || name.humanize
         }
+        if @@formatters[name] && @@formatters[name] != entry
+          raise ArgumentError, "format name '#{name}' is already taken"
+        end
+        @@formatters[name] = entry
       end
 
       def formatter