FIX: Embedded topics couldn't update their titles
This commit is contained in:
parent
8f5314bf98
commit
56a23c68f1
|
@ -92,12 +92,10 @@ class TopicEmbed < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
if content_sha1 != embed.content_sha1
|
if content_sha1 != embed.content_sha1
|
||||||
post.revise(
|
changes = { raw: absolutize_urls(url, contents) }
|
||||||
user,
|
changes[:title] = title if title.present?
|
||||||
{ raw: absolutize_urls(url, contents) },
|
|
||||||
skip_validations: true,
|
post.revise(user, changes, skip_validations: true, bypass_rate_limiter: true)
|
||||||
bypass_rate_limiter: true
|
|
||||||
)
|
|
||||||
embed.update!(content_sha1: content_sha1)
|
embed.update!(content_sha1: content_sha1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -46,8 +46,9 @@ describe TopicEmbed do
|
||||||
|
|
||||||
it "Supports updating the post content" do
|
it "Supports updating the post content" do
|
||||||
expect do
|
expect do
|
||||||
TopicEmbed.import(user, url, title, "muhahaha new contents!")
|
TopicEmbed.import(user, url, "New title received", "muhahaha new contents!")
|
||||||
end.to change { topic_embed.reload.content_sha1 }
|
end.to change { topic_embed.reload.content_sha1 }
|
||||||
|
expect(topic_embed.topic.title).to eq("New title received")
|
||||||
|
|
||||||
expect(topic_embed.post.cooked).to match(/new contents/)
|
expect(topic_embed.post.cooked).to match(/new contents/)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue