From 8bdb142e0f1d84f96c0ab2cd077292059814c6bb Mon Sep 17 00:00:00 2001 From: Nivedita Priyadarshini Date: Tue, 15 Oct 2024 19:43:50 +0530 Subject: [PATCH] Fix submission config update to store internal flag for a channel --- .../config/release_platforms_controller.rb | 11 +++++++---- app/models/release_platform.rb | 1 - 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/controllers/config/release_platforms_controller.rb b/app/controllers/config/release_platforms_controller.rb index d77e8f8c6..64fafc4ed 100644 --- a/app/controllers/config/release_platforms_controller.rb +++ b/app/controllers/config/release_platforms_controller.rb @@ -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 @@ -147,7 +151,7 @@ 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 @@ -155,7 +159,6 @@ def find_submission_name(submission, variant) 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) diff --git a/app/models/release_platform.rb b/app/models/release_platform.rb index 66ba3810d..0574cc93d 100644 --- a/app/models/release_platform.rb +++ b/app/models/release_platform.rb @@ -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