FIX: stop using inline quote for local onebox

This commit is contained in:
Sam 2017-06-27 10:57:29 -04:00
parent bca678ee5a
commit 5897ae945a
2 changed files with 13 additions and 1 deletions

View File

@ -56,7 +56,7 @@ module Onebox
excerpt.gsub!(/[\r\n]+/, " ")
excerpt.gsub!("[/quote]", "[quote]") # don't break my quote
quote = "[quote=\"#{post.user.username}, topic:#{topic.id}, slug:#{slug}, post:#{post.post_number}\"]#{excerpt}[/quote]"
quote = "[quote=\"#{post.user.username}, topic:#{topic.id}, slug:#{slug}, post:#{post.post_number}\"]\n#{excerpt}\n[/quote]"
args = {}
args[:topic_id] = source_topic_id if source_topic_id > 0

View File

@ -658,6 +658,18 @@ HTML
expect(cooked.scan('quote]').length).to eq(0)
end
it "can onebox local topics" do
op = Fabricate(:post)
reply = Fabricate(:post, topic_id: op.topic_id)
url = Discourse.base_url + reply.url
quote = create_post(topic_id: op.topic.id, raw: "This is a sample reply with a quote\n\n#{url}")
quote.reload
expect(quote.cooked).not_to include('[quote')
end
it "do off topic quoting with emoji unescape" do
topic = Fabricate(:topic, title: "this is a test topic :slight_smile:")