File tree 4 files changed +17
-3
lines changed
views/api/v2/system_settings
4 files changed +17
-3
lines changed Original file line number Diff line number Diff line change 8
8
# SystemSetting should be invoked using the singleton SystemSettings#current method.
9
9
# Any update to the data will only take effect after the system is rebooted
10
10
# and the singleton is reloaded.
11
+ # rubocop:disable Metrics/ClassLength
11
12
class SystemSettings < ApplicationRecord
12
13
include LocalizableJsonProperty
13
14
include ConfigurationRecord
@@ -144,6 +145,10 @@ def maximum_users_fields_present?
144
145
maximum_users . is_a? ( Integer ) && maximum_users_warning . is_a? ( Integer )
145
146
end
146
147
148
+ def maximum_attachments_per_record
149
+ super || Attachment ::DEFAULT_MAX_ATTACHMENTS
150
+ end
151
+
147
152
class << self
148
153
def current ( rebuild = false )
149
154
return @current unless @current . nil? || rebuild
@@ -174,3 +179,4 @@ def primary_age_ranges
174
179
end
175
180
end
176
181
end
182
+ # rubocop:enable Metrics/ClassLength
Original file line number Diff line number Diff line change @@ -15,6 +15,9 @@ json.data do
15
15
json . reporting_location_config current_user . role . reporting_location_config
16
16
json . approvals_labels FieldI18nService . to_localized_values ( @system_setting . approvals_labels_i18n )
17
17
json . export_require_password ZipService . require_password?
18
+ json . system_options @system_setting . system_options
19
+ . merge ( 'maximum_attachments_per_record' =>
20
+ @system_setting . maximum_attachments_per_record )
18
21
if code_of_conduct
19
22
json . code_of_conduct do
20
23
json . partial! 'api/v2/codes_of_conduct/code_of_conduct' , code_of_conduct :
Original file line number Diff line number Diff line change 73
73
expect ( @system_settings ) . to be_valid
74
74
end
75
75
end
76
+
77
+ context '#maximum_attachments_per_record' do
78
+ it 'when is not defined return default value' do
79
+ expect ( @system_settings . maximum_attachments_per_record ) . to eq ( Attachment ::DEFAULT_MAX_ATTACHMENTS )
80
+ end
81
+ end
76
82
end
77
83
end
Original file line number Diff line number Diff line change 68
68
case_plan : 'Case Plan' ,
69
69
closure : 'Closure'
70
70
} ,
71
- maximum_users : 55 ,
72
- maximum_attachments_per_record : 23
71
+ maximum_users : 55
73
72
)
74
73
end
75
74
88
87
expect ( json [ 'data' ] [ 'system_options' ] [ 'maximum_users' ] ) . to eq ( @system_settings . maximum_users )
89
88
expect (
90
89
json [ 'data' ] [ 'system_options' ] [ 'maximum_attachments_per_record' ]
91
- ) . to eq ( @system_settings . maximum_attachments_per_record )
90
+ ) . to eq ( @system_settings . maximum_attachments_per_record )
92
91
end
93
92
94
93
it 'lists system_settings and all agencies and all modules when the param *extended* is true on the request' do
You can’t perform that action at this time.
0 commit comments