Project

General

Profile

Defect #38155 » Make_Redmine_preparation_idempotent.patch

Thomas Löber, 2023-01-05 18:17

View differences:

lib/redmine/access_control.rb
84 84

  
85 85
      def permission(name, hash, options={})
86 86
        @permissions ||= []
87
        @permissions.reject! {|p| p.name == name}
87 88
        options[:project_module] = @project_module
88 89
        @permissions << Permission.new(name, hash, options)
89 90
      end
lib/redmine/menu_manager.rb
296 296
          target_root = @menu_items.root
297 297
        end
298 298

  
299
        target_root.children.reject! {|item| item.name == name}
300

  
299 301
        # menu item position
300 302
        if first = options.delete(:first)
301 303
          target_root.prepend(MenuItem.new(name, url, options))
......
383 385

  
384 386
      # Adds a child at given position
385 387
      def add_at(child, position)
386
        raise "Child already added" if find {|node| node.name == child.name}
387

  
388 388
        @children = @children.insert(position, child)
389 389
        child.parent = self
390 390
        child
lib/redmine/plugin.rb
125 125
      # Warn for potential settings[:partial] collisions
126 126
      if p.configurable?
127 127
        partial = p.settings[:partial]
128
        if @used_partials[partial]
129
          Rails.logger.warn(
130
            "WARNING: settings partial '#{partial}' is declared in '#{p.id}' plugin " \
131
              "but it is already used by plugin '#{@used_partials[partial]}'. " \
132
              "Only one settings view will be used. " \
133
              "You may want to contact those plugins authors to fix this."
134
          )
135
        end
136 128
        @used_partials[partial] = p.id
137 129
      end
138 130

  
lib/redmine/scm/base.rb
11 11
        # Add a new SCM adapter and repository
12 12
        def add(scm_name)
13 13
          @scms ||= []
14
          @scms.delete(scm_name)
14 15
          @scms << scm_name
15 16
        end
16 17

  
lib/redmine/wiki_formatting.rb
34 34
      def register(name, *args)
35 35
        options = args.last.is_a?(Hash) ? args.pop : {}
36 36
        name = name.to_s
37
        raise ArgumentError, "format name '#{name}' is already taken" if @@formatters[name]
38 37

  
39 38
        formatter, helper, parser =
40 39
          if args.any?
(1-1/2)