From cbf2e2e8f98184d6b9bc68bd7ba758ba1b571f1b Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Tue, 25 Feb 2014 14:08:48 -0500 Subject: [PATCH] FIX: DiscourseLocalOnebox should have a higher priority than other discourse sites --- Gemfile.lock | 2 +- lib/onebox/engine/discourse_local_onebox.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 964d8f4b5ea..8c03108e2ad 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -204,7 +204,7 @@ GEM omniauth-twitter (1.0.1) multi_json (~> 1.3) omniauth-oauth (~> 1.0) - onebox (1.2.4) + onebox (1.2.5) hexpress (~> 1.2) moneta (~> 0.7) multi_json (~> 1.7) diff --git a/lib/onebox/engine/discourse_local_onebox.rb b/lib/onebox/engine/discourse_local_onebox.rb index d67eb706df7..e8a6d1c071b 100644 --- a/lib/onebox/engine/discourse_local_onebox.rb +++ b/lib/onebox/engine/discourse_local_onebox.rb @@ -5,6 +5,11 @@ module Onebox matches_regexp Regexp.new("^#{Discourse.base_url.gsub(".","\\.")}.*$", true) + # Use this onebox before others + def self.priority + 1 + end + def to_html uri = URI::parse(@url) route = Rails.application.routes.recognize_path(uri.path)