discourse/app/controllers/qunit_controller.rb
Osama Sayegh a169dc6832
Revert "FEATURE: Allow theme tests to be run in production (#12815)" (#12840)
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.
2021-04-26 23:05:58 +03:00

27 lines
751 B
Ruby

# frozen_string_literal: true
class QunitController < ApplicationController
skip_before_action *%i{
check_xhr
preload_json
redirect_to_login_if_required
}
layout false
# only used in test / dev
def index
raise Discourse::InvalidAccess.new if Rails.env.production?
if (theme_name = params[:theme_name]).present?
theme = Theme.find_by(name: theme_name)
raise Discourse::NotFound if theme.blank?
elsif (theme_url = params[:theme_url]).present?
theme = RemoteTheme.find_by(remote_url: theme_url)
raise Discourse::NotFound if theme.blank?
end
if theme.present?
request.env[:resolved_theme_ids] = [theme.id]
request.env[:skip_theme_ids_transformation] = true
end
end
end