Joshua Wehner
276a53b5b4
Permit params needs update to allow saving mastodon (see 0baafea) ( #19210 )
2023-03-08 09:00:08 -08:00
yheuhtozr
ef290a5120
controllers/admin i18n ( #17085 )
...
* admin controllers i18n
* remove ja.yml
* fix for spec
* fix for spec 2
* Apply suggestions from code review
Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
* Update config/locales/controllers/admin/fr.yml
Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
2022-04-26 09:40:09 -06:00
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
Jeremy Friesen
a40efc6bbd
Refactoring questions asked of user ( #15762 )
...
* Refactoring questions asked of user
In this pull request, I'm extracting and normalizing role-based
questions asked of the user.
Prior to this commit, our codebase has asked two very similar questions
of our user model:
- `user.has_role?(:admin)`
- `user.admin?`
In asking `has_role?(:admin)` we are relying on implementation details
of the rolify gem. In addition, the `has_role?` question asked
throughout controllers or views means that it's harder to create
hieararchies of permissions.
In favoring `user.admin?` as our question, we can use that indirection
as an opportunity to discuss and decide "Should someone with the
`:super_admin` role be `user.admin? == true`?"
The details of this commit is to do three primary things:
1. Ask the `has_role?` questions in "one place" in the code (e.g. the
`Authorizer` module)
2. Extract the role based questions that are on the `User` model and
provde backwards compatable delegation.
3. Structure the code so that it's harder to accidentally call
`user.has_role?` (e.g., make `User#has_role?` and `User#has_any_role?`
private).
This is related to #15624 and the updates are informed by discussion in
PR #15691 . This commit supplants #15691 .
* Refactoring the liquid tag policy tests
* Fixing typo
* Bump for travis
2021-12-21 12:45:12 -05:00
Nick Taylor
6df9309284
Added the logo upload to the admin -> customization -> config -> images section. ( #15729 )
...
Co-authored-by: Michael Kohl <citizen428@forem.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
Co-authored-by: Mac Siri <mac@forem.com>
Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
2021-12-15 14:10:27 -05:00
Arit Amana
877cb5c322
Save Confirmation - Admin (Part 1 of 2) ( #14418 )
2021-09-02 11:49:05 -04:00
Keshav Biswa
247e1c48f0
Bust Content Cache after updation of Settings ( #14255 )
...
* bust content cache after settings update on admin
* removed bust_content_change_cache from the action
2021-07-19 10:20:59 +02:00
Mac Siri
e38196df6f
Create Settings::SMTP ( #13943 )
...
* Fix typo
* Add SMTP configs to Settings::General
* Expand Settings's show page
* Expand Settings::General's constants
* Move smtp_enabled? logic to ApplicationMailer
* Apply suggestions from code review
Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
* Add missing descriptions and placeholders
* Remove production guard clause
* Change delivery_method to a callback
* Create Settings::SMTP
* Run migration
* Move constants
* Remove SMTP from Settings::General
* Create SMTPSettingsController
* Add back guard clause
* Change which perform_deliveries configuration to use from
* Update config/environments/production.rb
* Rename migration to singular
* Run migration again
* Fix name
* Alphabetize and add validation for authentication
* Move settings and enabled? logic to Settings::SMTP
* Change after_action to before_action
* Fix broken spec
* Fix broken spec
* Create SMTP specs
* Provide default for port
* Create spec for ApplicationMailer
* Fix broken spec
* Move smtp_enabled?
* Search and replace
Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
2021-06-14 10:29:43 -04:00
Anna Buianova
26592a3a9c
Removing Settings::General.email_addresses ( #13958 )
...
* Replaced Settings::General.email_addresses with Forem.email
* Removed Settings::General.email_addresses remainders
* Fixed schema.rb
* Remove Settings::General.email_addresses record
* Fixed label for default email
2021-06-11 12:34:34 +03: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
111b7316d9
Remove mascot footer image ( #13642 )
...
* Remove footer mascot image
* Move remaining mascot settings back to SiteConfig
* Add data update script
* Update usages
* Fix path
* Remove dead route
* Update tests
* Fix view and spec
* Fix e2e test
* Fix DUS
2021-05-11 13:55:18 +02:00
Michael Kohl
3837c3a221
Refactor handling of mandatory settings ( #13553 )
...
* Refactor handling of mandatory settings
* Add e2e test
* Rename controller
2021-04-29 09:25:16 +07:00
Michael Kohl
1c7de11bef
Split Settings::UserExperience ( #13495 )
...
* Add Settings::UserExperience
* Add DUS
* Update usage
* Add controller
* Add e2e test
* Fix specs
2021-04-28 13:29:25 +07:00
Michael Kohl
610f6151e6
Split Settings::Community from SiteConfig ( #13403 )
...
* Add settings_community_contents model
* Add settings_communities model
* Update usage
* Add controller and update code
* Add e2e test
* Add data update script
* Update schema.rb
* Fix specs
* PR feedback
* Remove experience_* from Settings::Community
* Update spec
* Fix spec
2021-04-26 10:46:35 +02:00
Michael Kohl
f2f5e911cf
Add Settings::Mascot ( #13451 )
...
* Add Settings::Mascot
* Add DUS
* Update usage
* Fix e2e test and controller
* Fix specs
* Fix remaining spec
2021-04-26 11:39:19 +07:00
Michael Kohl
28dd50e718
Create settings model for rate limits ( #13381 )
...
Co-authored-by: rhymes <rhymes@hey.com>
2021-04-20 11:29:22 +07:00
Michael Kohl
a86c178fe0
Split Settings::Campaign from SiteConfig ( #13238 )
2021-04-19 10:01:03 +07: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