pull/11535/head
ulferts 2 years ago
parent a94c6a7b97
commit 6b594e498c
No known key found for this signature in database
GPG Key ID: A205708DE1284017
  1. 2
      Gemfile.lock
  2. 2
      app/models/custom_actions/actions/serializer.rb
  3. 2
      app/models/queries/work_packages/filter_serializer.rb
  4. 2
      config/constants/settings/definition.rb
  5. 4
      spec/constants/settings/definition_spec.rb

@ -719,7 +719,7 @@ GEM
pry-stack_explorer (0.6.1)
binding_of_caller (~> 1.0)
pry (~> 0.13)
psych (4.0.4)
psych (4.0.6)
stringio
public_suffix (5.0.0)
puffing-billy (3.0.4)

@ -33,7 +33,7 @@ module CustomActions::Actions::Serializer
return [] unless value
YAML
.safe_load(value, permitted_classes: [Symbol])
.safe_load(value, permitted_classes: [Symbol, Date])
.map do |key, values|
klass = nil

@ -37,7 +37,7 @@ module Queries::WorkPackages::FilterSerializer
yaml = serialized_filter_hash
.gsub('!ruby/object:Syck::DefaultKey {}', '"="')
(YAML.load(yaml) || {}).each_with_object([]) do |(field, options), array|
(YAML.load(yaml, permitted_classes: [Symbol, Date]) || {}).each_with_object([]) do |(field, options), array|
options = options.with_indifferent_access
filter = filter_for(field, no_memoization: true)
filter.operator = options['operator']

@ -89,6 +89,8 @@ module Settings
if format == :hash
self.value = {} if value.nil?
value.deep_merge! other_value.deep_stringify_keys
elsif format == :datetime && !other_value.is_a?(DateTime)
self.value = DateTime.parse(other_value)
else
self.value = other_value
end

@ -156,11 +156,11 @@ describe Settings::Definition do
.to be false
end
it 'overriding date configuration from ENV will cast the value' do
it 'overriding datetime configuration from ENV will cast the value' do
stub_const('ENV', { 'OPENPROJECT_CONSENT__TIME' => '2222-01-01' })
expect(all.detect { |d| d.name == 'consent_time' }.value)
.to eql Date.parse('2222-01-01')
.to eql DateTime.parse('2222-01-01')
end
it 'overriding configuration from ENV will set it to non writable' do

Loading…
Cancel
Save