Merge commit 'be991f1d18006a4820c1e9ca6625bf2bd2bfedac' into glitch-soc/merge-upstream
Conflicts: - `app/models/form/admin_settings.rb`: Upstream added the notion of overriden settings, while we had extra code for pseudo-settings (only used to combine flavour and skin in a single select field). Ported upstream changes. - `config/i18n-tasks.yml`: Upstream added `simple_form.overridden` to `ignore_unused`, we had `simple_form.glitch_only`. Added `simple_form.glitch_only` as well.
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
class Form::AdminSettings
|
||||
include ActiveModel::Model
|
||||
|
||||
include AuthorizedFetchHelper
|
||||
|
||||
KEYS = %i(
|
||||
site_contact_username
|
||||
site_contact_email
|
||||
@@ -42,6 +44,7 @@ class Form::AdminSettings
|
||||
backups_retention_period
|
||||
status_page_url
|
||||
captcha_enabled
|
||||
authorized_fetch
|
||||
).freeze
|
||||
|
||||
INTEGER_KEYS = %i(
|
||||
@@ -66,6 +69,7 @@ class Form::AdminSettings
|
||||
noindex
|
||||
require_invite_text
|
||||
captcha_enabled
|
||||
authorized_fetch
|
||||
).freeze
|
||||
|
||||
UPLOAD_KEYS = %i(
|
||||
@@ -77,6 +81,10 @@ class Form::AdminSettings
|
||||
flavour_and_skin
|
||||
).freeze
|
||||
|
||||
OVERRIDEN_SETTINGS = {
|
||||
authorized_fetch: :authorized_fetch_mode?,
|
||||
}.freeze
|
||||
|
||||
attr_accessor(*KEYS)
|
||||
|
||||
validates :registrations_mode, inclusion: { in: %w(open approved none) }, if: -> { defined?(@registrations_mode) }
|
||||
@@ -96,6 +104,8 @@ class Form::AdminSettings
|
||||
|
||||
stored_value = if UPLOAD_KEYS.include?(key)
|
||||
SiteUpload.where(var: key).first_or_initialize(var: key)
|
||||
elsif OVERRIDEN_SETTINGS.include?(key)
|
||||
public_send(OVERRIDEN_SETTINGS[key])
|
||||
else
|
||||
Setting.public_send(key)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user