From e859e95ee815e12c6fe1a0b0795a124bc35297ed Mon Sep 17 00:00:00 2001 From: aaronskiba Date: Thu, 20 Feb 2025 11:35:38 -0700 Subject: [PATCH] Update handling of default template in dropdown This change resolves https://github.com/portagenetwork/roadmap/issues/1013 Before this change, `!customization.upgrade_customization?` was applied to all templates populating the dropdown, except the default template. As a result, if an organization had customized and published an older version of the default template, but not the newest version, that newest version would be blocked from being populated in the dropdown. --- app/controllers/template_options_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/template_options_controller.rb b/app/controllers/template_options_controller.rb index fcd65b68f4..adda1d8ea2 100644 --- a/app/controllers/template_options_controller.rb +++ b/app/controllers/template_options_controller.rb @@ -61,7 +61,7 @@ def index # Always use the default template if Template.default.present? && org.present? customization = Template.published.latest_customized_version(Template.default.family_id, org.id).first - customization ||= Template.default + customization = Template.default unless customization.present? && !customization.upgrade_customization? @templates.select! { |t| t.id != Template.default.id && t.id != customization.id } # We want the default template to appear at the beggining of the list @templates.unshift(customization)