Skip to content

Commit

Permalink
ReSetting::ARTIFACT_TYPES clone
Browse files Browse the repository at this point in the history
There is a problem with line 107 (    all_artifact_types.delete_if { |v| configured_artifact_types.include? v }   ). If you add Requirements module to a project and save settings, then when you try to do the same thing in another project - ReSetting::ARTIFACT_TYPES is empty. I suggest cloning ReSetting::ARTIFACT_TYPES before delete_if in this context.

Failing use case:
1. Enable Requirements in project A.
2. Go to Requirements in project A, save settings.
3. Enable Requirements in project B.
4. Go to Requirements in project B, list of artifact types is empty. Save causes internal error.
  • Loading branch information
marekswiecznik committed Jul 15, 2015
1 parent 0ae6147 commit 1c8027e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/controllers/re_settings_controller.rb
Expand Up @@ -103,7 +103,7 @@ def initialize_artifact_order(project_id)
# Put it into the empty configured_artifact_types array
configured_artifact_types.concat(stored_settings) if stored_settings

all_artifact_types = ReSetting::ARTIFACT_TYPES
all_artifact_types = ReSetting::ARTIFACT_TYPES.clone
all_artifact_types.delete_if { |v| configured_artifact_types.include? v }
configured_artifact_types.concat(all_artifact_types)

Expand Down Expand Up @@ -210,4 +210,4 @@ def save_user_config

end

end
end

0 comments on commit 1c8027e

Please sign in to comment.