FIX: drop title updates through RSS feeds
can create an update loop
This commit is contained in:
parent
9ab1fb7dfc
commit
e25a6e085e
|
@ -74,8 +74,6 @@ class TopicEmbed < ActiveRecord::Base
|
||||||
|
|
||||||
# Update the topic if it changed
|
# Update the topic if it changed
|
||||||
if post&.topic
|
if post&.topic
|
||||||
revision = {}
|
|
||||||
|
|
||||||
if post.user != user
|
if post.user != user
|
||||||
PostOwnerChanger.new(
|
PostOwnerChanger.new(
|
||||||
post_ids: [post.id],
|
post_ids: [post.id],
|
||||||
|
@ -89,19 +87,14 @@ class TopicEmbed < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
if content_sha1 != embed.content_sha1
|
if content_sha1 != embed.content_sha1
|
||||||
revision[:raw] = absolutize_urls(url, contents)
|
post.revise(
|
||||||
end
|
user,
|
||||||
|
{ raw: absolutize_urls(url, contents) },
|
||||||
revision[:title] = title if title != post.topic.title
|
|
||||||
|
|
||||||
unless revision.empty?
|
|
||||||
post.revise(user, revision,
|
|
||||||
skip_validations: true,
|
skip_validations: true,
|
||||||
bypass_rate_limiter: true
|
bypass_rate_limiter: true
|
||||||
)
|
)
|
||||||
|
embed.update!(content_sha1: content_sha1)
|
||||||
end
|
end
|
||||||
|
|
||||||
embed.update!(content_sha1: content_sha1) if revision[:raw]
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,6 @@ describe Jobs::PollFeed do
|
||||||
expect { poller.poll_feed }.to_not change { Topic.count }
|
expect { poller.poll_feed }.to_not change { Topic.count }
|
||||||
|
|
||||||
post.reload
|
post.reload
|
||||||
expect(post.topic.title).to eq('Poll Feed Spec Fixture')
|
|
||||||
expect(post.raw).to include('<p>This is the body & content. </p>')
|
expect(post.raw).to include('<p>This is the body & content. </p>')
|
||||||
expect(post.user).to eq(feed_author)
|
expect(post.user).to eq(feed_author)
|
||||||
end
|
end
|
||||||
|
|
|
@ -41,13 +41,6 @@ describe TopicEmbed do
|
||||||
expect(post.topic.category).to eq(embeddable_host.category)
|
expect(post.topic.category).to eq(embeddable_host.category)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "Supports updating the post title" do
|
|
||||||
TopicEmbed.import(user, url, "I am a new title", contents)
|
|
||||||
|
|
||||||
topic_embed.reload
|
|
||||||
expect(topic_embed.post.topic.title).to eq("I am a new title")
|
|
||||||
end
|
|
||||||
|
|
||||||
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, title, "muhahaha new contents!")
|
||||||
|
|
Loading…
Reference in New Issue