DEV: Clean up ember configuration (#30833)

1. Add comments
2. Remove obsolete options: `historySupportMiddleware` (x2),
`exportApplicationGlobal` (x2), `_APPLICATION_TEMPLATE_WRAPPER`,
`_JQUERY_INTEGRATION`
3. Remove unused sections (dev, prod) from the test-only config
4. Add commented-out debug options to the "main" config
5. Copy options between configs for parity: `_DEFAULT_ASYNC_OBSERVERS`,
`LOG_ACTIVE_GENERATION`, `LOG_VIEW_LOOKUPS`
This commit is contained in:
Jarek Radosz
2025-01-17 10:39:21 +01:00
committed by GitHub
parent e63a804ec9
commit 560c1875a5
2 changed files with 15 additions and 19 deletions

View File

@ -13,6 +13,9 @@ module ApplicationHelper
@extra_body_classes ||= Set.new
end
# This generated equivalent of Ember's config/environment.js is used
# in development, production, and theme tests. (i.e. everywhere except
# regular tests)
def discourse_config_environment(testing: false)
# TODO: Can this come from Ember CLI somehow?
config = {
@ -20,7 +23,6 @@ module ApplicationHelper
environment: Rails.env,
rootURL: Discourse.base_path,
locationType: "history",
historySupportMiddleware: false,
EmberENV: {
FEATURES: {
},
@ -28,22 +30,26 @@ module ApplicationHelper
Date: false,
String: false,
},
_APPLICATION_TEMPLATE_WRAPPER: false,
_DEFAULT_ASYNC_OBSERVERS: true,
_JQUERY_INTEGRATION: true,
},
APP: {
name: "discourse",
version: "#{Discourse::VERSION::STRING} #{Discourse.git_version}",
exportApplicationGlobal: true,
# LOG_RESOLVER: true,
# LOG_ACTIVE_GENERATION: true,
# LOG_TRANSITIONS: true,
# LOG_TRANSITIONS_INTERNAL: true,
# LOG_VIEW_LOOKUPS: true,
},
}
if testing
config[:environment] = "test"
config[:locationType] = "none"
config[:APP][:autoboot] = false
config[:APP][:LOG_ACTIVE_GENERATION] = false
config[:APP][:LOG_VIEW_LOOKUPS] = false
config[:APP][:rootElement] = "#ember-testing"
config[:APP][:autoboot] = false
end
config.to_json