OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[#50219] Custom export cover background overlay color won't return to the default one after deleting
as-opc2d009fc80fa
diff --git a/app/controllers/custom_styles_controller.rb b/app/controllers/custom_styles_controller.rbindex 2132070279f..3fdf20f015b 100644--- a/app/controllers/custom_styles_controller.rb+++ b/app/controllers/custom_styles_controller.rb@@ -74,7 +74,8 @@ class CustomStylesController < ApplicationControllerendcolor_hexcode_regex = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/- if !color.nil? && color.match(color_hexcode_regex)+ color = nil if color.blank?+ if color.nil? || color.match(color_hexcode_regex)@custom_style.export_cover_text_color = color@custom_style.saveenddiff --git a/spec/controllers/custom_styles_controller_spec.rb b/spec/controllers/custom_styles_controller_spec.rbindex 163344da61e..180f7f4f30c 100644--- a/spec/controllers/custom_styles_controller_spec.rb+++ b/spec/controllers/custom_styles_controller_spec.rb@@ -489,6 +489,23 @@ RSpec.describe CustomStylesController doendend+ context 'with valid empty parameter' do+ let(:params) do+ { export_cover_text_color: '' }+ end++ before do+ custom_style.export_cover_text_color = "#990000"+ custom_style.save+ post :update_export_cover_text_color, params:+ end++ it "removes the color" do+ expect(custom_style.export_cover_text_color).to be_nil+ expect(response).to redirect_to action: :show+ end+ end+context 'with invalid parameter' dolet(:params) do{ export_cover_text_color: "red" } # we only accept hexcodes