mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
Merge pull request #3387 from riking/fix-uploaded-onebox
FIX: Local files never oneboxed, onebox requests cache-busted
This commit is contained in:
commit
afc12da2f9
2 changed files with 21 additions and 1 deletions
|
@ -51,7 +51,8 @@ Discourse.Onebox = {
|
||||||
// Retrieve the onebox
|
// Retrieve the onebox
|
||||||
var promise = Discourse.ajax("/onebox", {
|
var promise = Discourse.ajax("/onebox", {
|
||||||
dataType: 'html',
|
dataType: 'html',
|
||||||
data: { url: url, refresh: refresh }
|
data: { url: url, refresh: refresh },
|
||||||
|
cache: true
|
||||||
});
|
});
|
||||||
|
|
||||||
// We can call this when loading is complete
|
// We can call this when loading is complete
|
||||||
|
|
|
@ -10,6 +10,25 @@ module Onebox
|
||||||
1
|
1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.===(other)
|
||||||
|
if other.kind_of?(URI)
|
||||||
|
uri = other
|
||||||
|
begin
|
||||||
|
route = Rails.application.routes.recognize_path(uri.path)
|
||||||
|
case route[:controller]
|
||||||
|
when 'topics'
|
||||||
|
true
|
||||||
|
else
|
||||||
|
false
|
||||||
|
end
|
||||||
|
rescue ActionController::RoutingError
|
||||||
|
false
|
||||||
|
end
|
||||||
|
else
|
||||||
|
super
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def to_html
|
def to_html
|
||||||
uri = URI::parse(@url)
|
uri = URI::parse(@url)
|
||||||
route = Rails.application.routes.recognize_path(uri.path)
|
route = Rails.application.routes.recognize_path(uri.path)
|
||||||
|
|
Loading…
Reference in a new issue