mirror of
https://github.com/discourse/discourse.git
synced 2026-03-04 01:15:08 +08:00
`strict_loading` was added to prevent it happening in the future. Few adjustments had to be made: - include color_scheme and color_scheme_colors, also for parent and child themes; - internal translations were using preload_fields, but it was too deep to correctly use preloaded tables. I had to pass `preloaded_locale_fields` manually; - include theme in color_scheme. Before: <img width="663" alt="Screenshot 2025-05-15 at 3 43 47 pm" src="https://github.com/user-attachments/assets/b55ce11e-80cb-43eb-8e31-940b0e9859f3" /> After: <img width="665" alt="Screenshot 2025-05-16 at 11 29 00 am" src="https://github.com/user-attachments/assets/f00bac19-f64b-4048-b220-4d0a9d90a929" />
20 lines
462 B
Ruby
20 lines
462 B
Ruby
# frozen_string_literal: true
|
|
|
|
class BasicThemeSerializer < ApplicationSerializer
|
|
attributes :id, :name, :description, :created_at, :updated_at, :default, :component
|
|
|
|
def include_default?
|
|
object.id == SiteSetting.default_theme_id
|
|
end
|
|
|
|
def default
|
|
true
|
|
end
|
|
|
|
def description
|
|
object
|
|
.internal_translations(preloaded_locale_fields: object.locale_fields)
|
|
.find { |t| t.key == "theme_metadata.description" }
|
|
&.value
|
|
end
|
|
end
|