Skip to content

Commit

Permalink
Fix submission config update to store internal flag for a channel
Browse files Browse the repository at this point in the history
  • Loading branch information
nid90 committed Oct 15, 2024
1 parent 8413fa9 commit 8bdb142
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
11 changes: 7 additions & 4 deletions app/controllers/config/release_platforms_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,13 @@ def update_submission_params(release_attributes)
if release_attributes.present?
release_attributes[:submissions_attributes]&.each do |_, submission|
variant = @submission_types[:variants].find { |v| v[:id] == submission[:integrable_id] }

submission[:submission_external_attributes][:name] = find_submission_name(submission, variant)
submission[:integrable_type] = variant[:type]

ext_sub = find_submission(submission, variant)
if ext_sub.present?
submission[:submission_external_attributes][:name] = ext_sub[:name]
submission[:submission_external_attributes][:internal] = ext_sub[:is_internal]
end
end
end
end
Expand All @@ -147,15 +151,14 @@ def find_workflow_name(identifier)
@ci_actions.find { |action| action[:id] == identifier }&.dig(:name)
end

def find_submission_name(submission, variant)
def find_submission(submission, variant)
return if variant.blank?
identifier = submission.dig(:submission_external_attributes, :identifier)
return unless identifier

variant[:submissions].find { |type| type[:type].to_s == submission[:submission_type].to_s }
&.then { |sub| sub.dig(:channels) }
&.then { |channels| channels.find { |channel| channel[:id].to_s == identifier } }
&.then { |channel| channel[:name] }
end

def set_destroy!(param)
Expand Down
1 change: 0 additions & 1 deletion app/models/release_platform.rb
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ def set_default_config
end
end


if base_config_map[:production_release].nil?
providable = app.integrations.build_channel.first.providable
providable_type = providable.class
Expand Down

0 comments on commit 8bdb142

Please sign in to comment.