mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
fix tests and allow SE onebox to onebox Meta cause I need that for an post I am writing
This commit is contained in:
@@ -12,7 +12,7 @@ module Oneboxer
|
||||
|
||||
# http://rubular.com/r/V3T0I1VTPn
|
||||
REGEX =
|
||||
/^http:\/\/(?:(?<subdomain>\w*)\.)?(?<domain>#{DOMAINS.join('|')})\.com\/(?:questions|q)\/(?<question>\d*)/
|
||||
/^http:\/\/(?:(?:(?<subsubdomain>\w*)\.)?(?<subdomain>\w*)\.)?(?<domain>#{DOMAINS.join('|')})\.com\/(?:questions|q)\/(?<question>\d*)/
|
||||
|
||||
matcher REGEX
|
||||
favicon 'stackexchange.png'
|
||||
@@ -20,9 +20,9 @@ module Oneboxer
|
||||
def translate_url
|
||||
@url.match(REGEX) do |match|
|
||||
site = if match[:domain] == 'stackexchange'
|
||||
match[:subdomain]
|
||||
[match[:subsubdomain],match[:subdomain]].compact.join('.')
|
||||
else
|
||||
match[:domain]
|
||||
[match[:subdomain],match[:domain]].compact.join('.')
|
||||
end
|
||||
|
||||
["http://api.stackexchange.com/2.1/",
|
||||
|
||||
Reference in New Issue
Block a user