mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: discourse local onebox not working correctly in multisite
This commit is contained in:
parent
4ceb04517f
commit
6688dce2b8
@ -3,7 +3,10 @@ module Onebox
|
|||||||
class DiscourseLocalOnebox
|
class DiscourseLocalOnebox
|
||||||
include Engine
|
include Engine
|
||||||
|
|
||||||
matches_regexp Regexp.new("^#{Discourse.base_url.gsub(".","\\.")}.*$", true)
|
# we need to allow for multisite here
|
||||||
|
def self.is_on_site?(url)
|
||||||
|
Regexp.new("^#{Discourse.base_url.gsub(".","\\.")}.*$", true) === url.to_s
|
||||||
|
end
|
||||||
|
|
||||||
# Use this onebox before others
|
# Use this onebox before others
|
||||||
def self.priority
|
def self.priority
|
||||||
@ -17,10 +20,10 @@ module Onebox
|
|||||||
route = Rails.application.routes.recognize_path(uri.path.sub(Discourse.base_uri, ""))
|
route = Rails.application.routes.recognize_path(uri.path.sub(Discourse.base_uri, ""))
|
||||||
case route[:controller]
|
case route[:controller]
|
||||||
when 'uploads'
|
when 'uploads'
|
||||||
super
|
is_on_site?(other)
|
||||||
when 'topics'
|
when 'topics'
|
||||||
# super will use matches_regexp to match the domain name
|
# super will use matches_regexp to match the domain name
|
||||||
super
|
is_on_site?(other)
|
||||||
else
|
else
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
@ -28,7 +31,7 @@ module Onebox
|
|||||||
false
|
false
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
super
|
is_on_site?(other)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user