mirror of
https://github.com/discourse/discourse.git
synced 2025-09-05 08:59:27 +08:00
Make DISCOURSE_NO_CONSTANTS work in anon for home page
This commit is contained in:
parent
cf389e0137
commit
09bedfd4c0
2 changed files with 31 additions and 13 deletions
|
@ -74,6 +74,24 @@ module Tilt
|
|||
rval
|
||||
end
|
||||
|
||||
def whitelisted?(path)
|
||||
|
||||
@@whitelisted ||= Set.new(
|
||||
["discourse/models/nav-item",
|
||||
"discourse/models/user-action",
|
||||
"discourse/routes/discourse",
|
||||
"discourse/models/category",
|
||||
"discourse/models/trust-level",
|
||||
"discourse/models/site",
|
||||
"discourse/models/user",
|
||||
"discourse/models/session",
|
||||
"discourse/models/model",
|
||||
"discourse/views/grouped"]
|
||||
)
|
||||
|
||||
@@whitelisted.include?(path) || path =~ /discourse\/mixins/
|
||||
end
|
||||
|
||||
def evaluate(scope, locals, &block)
|
||||
return @output if @output
|
||||
|
||||
|
@ -86,7 +104,7 @@ module Tilt
|
|||
# For backwards compatibility with plugins, for now export the Global format too.
|
||||
# We should eventually have an upgrade system for plugins to use ES6 or some other
|
||||
# resolve based API.
|
||||
if ENV['DISCOURSE_NO_CONSTANTS'].nil? &&
|
||||
if (ENV['DISCOURSE_NO_CONSTANTS'].nil? || whitelisted?(scope.logical_path)) &&
|
||||
scope.logical_path =~ /(discourse|admin)\/(controllers|components|views|routes|mixins|models)\/(.*)/
|
||||
|
||||
type = Regexp.last_match[2]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue