mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-07 05:15:58 +08:00
<img width="2224" height="1674" alt="image" src="https://github.com/user-attachments/assets/7c1a00f6-d437-4146-8f32-bab90a514054" />
23 lines
657 B
Ruby
23 lines
657 B
Ruby
# frozen_string_literal: true
|
|
class Admin::Config::WelcomeBannerController < Admin::AdminController
|
|
def index
|
|
end
|
|
|
|
def themes_with_setting
|
|
themes =
|
|
Theme
|
|
.not_components
|
|
.where("themes.id = ? OR themes.user_selectable = ?", SiteSetting.default_theme_id, true)
|
|
.includes(:theme_site_settings)
|
|
|
|
themes_data =
|
|
themes.map do |theme|
|
|
setting = theme.theme_site_settings.find { |s| s.name == "enable_welcome_banner" }
|
|
value = setting&.setting_rb_value || false
|
|
|
|
{ id: theme.id, name: theme.name, enable_welcome_banner: value }
|
|
end
|
|
|
|
render json: { themes: themes_data }
|
|
end
|
|
end
|