mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 21:10:17 +08:00
a169dc6832
This reverts commit 7217dcb67a
.
https://meta.discourse.org/t/failed-to-bootstrap-due-to-out-of-memory-killer/188141/18?u=osama
Precompiling test_helper.js is so expensive that it can make bootstrap
fail on servers with limited resources (2GB RAM). We will find another
way that doesn't require much resources.
25 lines
675 B
Ruby
25 lines
675 B
Ruby
# frozen_string_literal: true
|
|
|
|
module QunitHelper
|
|
def theme_tests
|
|
theme_ids = request.env[:resolved_theme_ids]
|
|
return "" if theme_ids.blank?
|
|
|
|
skip_transformation = request.env[:skip_theme_ids_transformation]
|
|
query = ThemeField
|
|
.joins(:theme)
|
|
.where(
|
|
target_id: Theme.targets[:tests_js],
|
|
theme_id: skip_transformation ? theme_ids : Theme.transform_ids(theme_ids)
|
|
)
|
|
.pluck(:theme_id)
|
|
.uniq
|
|
.map do |theme_id|
|
|
src = "#{GlobalSetting.cdn_url}#{Discourse.base_path}/theme-javascripts/tests/#{theme_id}.js"
|
|
"<script src='#{src}'></script>"
|
|
end
|
|
.join("\n")
|
|
.html_safe
|
|
end
|
|
end
|