Project

General

Profile

Defect #38155 » Make_Redmine_preparation_idempotent_v2.patch

Thomas Löber, 2023-01-24 14:21

View differences:

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

  
298 300
        # menu item position
299 301
        if first = options.delete(:first)
300 302
          target_root.prepend(MenuItem.new(name, url, options))
......
383 385
      # Adds a child at given position
384 386
      def add_at(child, position)
385
        raise "Child already added" if find {|node| node.name == child.name}
386

  
387 387
        @children = @children.insert(position, child)
388 388
        child.parent = self
389 389
        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]
128
        if @used_partials[partial] && @used_partials[partial] != p.id
129 129
          Rails.logger.warn(
130 130
            "WARNING: settings partial '#{partial}' is declared in '#{p.id}' plugin " \
131 131
              "but it is already used by plugin '#{@used_partials[partial]}'. " \
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
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
        formatter, helper, parser =
39 38
          if args.any?
......
44 43
          end
45 44
        raise "A formatter class is required" if formatter.nil?
46
        @@formatters[name] = {
45
        entry = {
47 46
          :formatter => formatter,
48 47
          :helper => helper,
49 48
          :html_parser => parser,
50 49
          :label => options[:label] || name.humanize
51 50
        }
51
        if @@formatters[name] && @@formatters[name] != entry
52
          raise ArgumentError, "format name '#{name}' is already taken"
53
        end
54
        @@formatters[name] = entry
52 55
      end
53 56
      def formatter
(2-2/2)