Jeremy Friesen
5534a8fa18
Addressing rubocop violations ( #16156 )
...
```shell
❯ bundle exec rubocop -A
Inspecting 1856 files
Offenses:
app/controllers/admin/settings/mandatory_settings_controller.rb:17:57: C: [Corrected] Rails/CompactBlank: Use compact_blank instead.
settings_model.public_send("#{key}=", value.reject(&:blank?)) if value.present?
^^^^^^^^^^^^^^^^
app/controllers/users_controller.rb:66:58: C: [Corrected] Rails/CompactBlank: Use compact_blank instead.
Honeycomb.add_field("error", @user.errors.messages.reject { |_, v| v.empty? })
^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/users_controller.rb:280:58: C: [Corrected] Rails/CompactBlank: Use compact_blank instead.
Honeycomb.add_field("error", @user.errors.messages.reject { |_, v| v.empty? })
^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/settings/base.rb:111:54: C: [Corrected] Rails/CompactBlank: Use compact_blank instead.
value.split(separator || SEPARATOR_REGEXP).reject(&:empty?).map(&:strip)
^^^^^^^^^^^^^^^^
app/services/articles/feeds/weighted_query_strategy.rb:269:121: C: Layout/LineLength: Line is too long. [126/120] (https://rubystyle.guide#max-line-length )
def initialize(user: nil, number_of_articles: 50, page: 1, tag: nil, strategy: AbExperiment::ORIGINAL_VARIANT, **config)
^^^^^^
app/services/images/optimizer.rb:27:50: C: [Corrected] Rails/CompactBlank: Use compact_blank instead.
options = DEFAULT_CL_OPTIONS.merge(kwargs).reject { |_, v| v.blank? }
^^^^^^^^^^^^^^^^^^^^^^^^^^
app/services/images/optimizer.rb:46:68: C: [Corrected] Rails/CompactBlank: Use compact_blank instead.
options = DEFAULT_IMGPROXY_OPTIONS.merge(translated_options).reject { |_, v| v.blank? }
^^^^^^^^^^^^^^^^^^^^^^^^^^
app/services/settings/upsert.rb:30:55: C: [Corrected] Rails/CompactBlank: Use compact_blank instead.
settings_class.public_send("#{key}=", value.reject(&:blank?))
^^^^^^^^^^^^^^^^
1856 files inspected, 8 offenses detected, 7 offenses corrected
```
After this commit:
```shell
❯ bundle exec rubocop
Inspecting 1856 files
1856 files inspected, no offenses detected
```
1856 files inspected, no offenses detected
2022-01-17 17:21:06 -05:00
Michael Kohl
dcf942e3a2
Add Admin:Settings controllers ( #13851 )
...
* Add Admin:Settings::BaseController and refactor
* Further simplify controllers
* Add comments, more cleanup
* Update mandatory settings controller
* Update spec
* Update service object and spec
* Update controller
* Update app/services/settings/general/upsert.rb
Co-authored-by: Jamie Gaskins <jamie@forem.com>
Co-authored-by: Jamie Gaskins <jamie@forem.com>
2021-06-08 10:13:55 +07:00
Michael Kohl
6dfabd578f
Rename SiteConfig to Settings::General ( #13573 )
...
* Rename SiteConfig
* More renaming
* Update spec
* Update mandatory settings mapping
* More renaming
* e2e test fixes
* You have a rename, and you have a rename
* Spec fix
* More changes
* Temporarily disable specs
* After-merge update
* Undo rename for migration
* undo rename of DUS
* Fix DUS
* Fix merge problem
* Remove redundant DUS
* Fix specs
* Remove unused code
* Change wrong class name
* More cleanup
* Re-add missing values to constant
* Fix constant
* Fix spec
* Remove obsolete fields
* Add accidentally removed field
* Update spec
* Move methods from Settings::General to ForemInstance
* Remove unneeded model
* Change mentions of 'site config'
2021-05-21 14:45:37 +02:00
Michael Kohl
5406b0576e
Split Settings::Authentication from SiteConfig ( #13095 )
...
* Split Settings::Authentication from SiteConfig
* Move specs
* Sort fields
* Update settings usages
* Update recaptcha usages
* Add data update script
* Update spec
* Rename SiteConfigParams concern
* Fixes, new route, new controller
* Controller and service refactoring
* More controller and service updates
* Spec updates
* More spec fixes
* Move file
* Fix FeedbackMessagesController
* Update admin/configs_spec
* Fix remaining specs in admin/configs_spec
* Fix configs API
* Formatting
* Clean up old service object
* Various fixes
* Update DUS
* Add model argument to admin_config_label
* Fix key name
* Fix specs
* Add distinct request caches for settings classes
* Fix e2e tests
* Fix remaining system spec
* Make DUS idempotent
* Move routes block
* Cleanup
* Switch to ActiveSupport::CurrentAttributes
* Pinned rails-settings-cached
* Update e2e test
* Update lib/data_update_scripts/20210316091354_move_authentication_settings.rb
Co-authored-by: rhymes <rhymes@hey.com>
* Add guard to DUS
* Temporarily re-add two SiteConfig fields
* Fix config show view
Co-authored-by: rhymes <rhymes@hey.com>
2021-04-12 09:41:09 +02:00