mirror of
https://github.com/discourse/discourse.git
synced 2025-06-25 01:30:17 +08:00
FEATURE: fonts section for branding page (#32031)
New configure fonts section was added. Because now we have two sections completed (logos and fonts), new /branding page was introduced and old /logo and /font pages was removed. When text size is changed, modal is displayed to ask if preferences of existing users should be retrospectively updated. https://github.com/user-attachments/assets/f6b0c92a-117f-4064-bd76-30fa05acc6d3 --------- Co-authored-by: Ella <ella.estigoy@gmail.com> Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>
This commit is contained in:

committed by
GitHub

parent
637a221517
commit
928f9175f0
@ -38,4 +38,36 @@ class Admin::Config::BrandingController < Admin::AdminController
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def fonts
|
||||
previous_default_text_size = SiteSetting.default_text_size
|
||||
SiteSetting::Update.call(
|
||||
guardian:,
|
||||
params: {
|
||||
settings: [
|
||||
{ setting_name: "base_font", value: params[:base_font] },
|
||||
{ setting_name: "heading_font", value: params[:heading_font] },
|
||||
{
|
||||
setting_name: "default_text_size",
|
||||
value: params[:default_text_size],
|
||||
backfill: params[:update_existing_users] == "true",
|
||||
},
|
||||
],
|
||||
},
|
||||
) do
|
||||
on_success { render json: success_json }
|
||||
on_failed_policy(:settings_are_visible) do |policy|
|
||||
raise Discourse::InvalidParameters, policy.reason
|
||||
end
|
||||
on_failed_policy(:settings_are_unshadowed_globally) do |policy|
|
||||
raise Discourse::InvalidParameters, policy.reason
|
||||
end
|
||||
on_failed_policy(:settings_are_configurable) do |policy|
|
||||
raise Discourse::InvalidParameters, policy.reason
|
||||
end
|
||||
on_failed_policy(:values_are_valid) do |policy|
|
||||
raise Discourse::InvalidParameters, policy.reason
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user