Test failures for Inline Onebox
This commit is contained in:
parent
3882722195
commit
d2490cbbb8
|
@ -228,6 +228,8 @@ module Discourse
|
||||||
return Rails.application.routes.recognize_path(path)
|
return Rails.application.routes.recognize_path(path)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
nil
|
||||||
|
rescue ActionController::RoutingError
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,7 @@ class InlineOneboxer
|
||||||
if route = Discourse.route_for(url)
|
if route = Discourse.route_for(url)
|
||||||
if route[:controller] == "topics" &&
|
if route[:controller] == "topics" &&
|
||||||
route[:action] == "show" &&
|
route[:action] == "show" &&
|
||||||
|
topic = (Topic.where(id: route[:topic_id].to_i).first rescue nil)
|
||||||
topic = Topic.where(id: route[:topic_id].to_i).first
|
|
||||||
|
|
||||||
# Only public topics
|
# Only public topics
|
||||||
if Guardian.new.can_see?(topic)
|
if Guardian.new.can_see?(topic)
|
||||||
|
|
|
@ -498,7 +498,7 @@ describe Email::Receiver do
|
||||||
it "adds the 'elided' part of the original message when always_show_trimmed_content is enabled" do
|
it "adds the 'elided' part of the original message when always_show_trimmed_content is enabled" do
|
||||||
SiteSetting.always_show_trimmed_content = true
|
SiteSetting.always_show_trimmed_content = true
|
||||||
|
|
||||||
user = Fabricate(:user, email: "existing@bar.com", trust_level: SiteSetting.email_in_min_trust)
|
Fabricate(:user, email: "existing@bar.com", trust_level: SiteSetting.email_in_min_trust)
|
||||||
expect { process(:forwarded_email_to_category) }.to change{Topic.count}.by(1) # Topic created
|
expect { process(:forwarded_email_to_category) }.to change{Topic.count}.by(1) # Topic created
|
||||||
|
|
||||||
new_post, = Post.last
|
new_post, = Post.last
|
||||||
|
|
|
@ -48,7 +48,13 @@ describe InlineOneboxer do
|
||||||
expect(onebox[:url]).to eq(topic.url)
|
expect(onebox[:url]).to eq(topic.url)
|
||||||
expect(onebox[:title]).to eq(topic.title)
|
expect(onebox[:title]).to eq(topic.title)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "returns nothing for unknown links" do
|
||||||
|
expect(InlineOneboxer.lookup(nil)).to be_nil
|
||||||
|
expect(InlineOneboxer.lookup("/test")).to be_nil
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue