mirror of
https://github.com/discourse/discourse.git
synced 2025-03-06 03:09:43 +00: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
|
||||
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
|
||||
def self.priority
|
||||
@ -17,10 +20,10 @@ module Onebox
|
||||
route = Rails.application.routes.recognize_path(uri.path.sub(Discourse.base_uri, ""))
|
||||
case route[:controller]
|
||||
when 'uploads'
|
||||
super
|
||||
is_on_site?(other)
|
||||
when 'topics'
|
||||
# super will use matches_regexp to match the domain name
|
||||
super
|
||||
is_on_site?(other)
|
||||
else
|
||||
false
|
||||
end
|
||||
@ -28,7 +31,7 @@ module Onebox
|
||||
false
|
||||
end
|
||||
else
|
||||
super
|
||||
is_on_site?(other)
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user