FIX: Avoid pulling hotlinked images of post that have been deleted. (#11913)
This commit is contained in:
parent
3744e49190
commit
0cc178d58b
|
@ -15,6 +15,7 @@ module Jobs
|
|||
|
||||
post = Post.find_by(id: @post_id)
|
||||
return if post.blank?
|
||||
return if post.topic.blank?
|
||||
|
||||
raw = post.raw.dup
|
||||
start_raw = raw.dup
|
||||
|
|
|
@ -42,6 +42,15 @@ describe Jobs::PullHotlinkedImages do
|
|||
Jobs.run_immediately!
|
||||
end
|
||||
|
||||
it 'does nothing if topic has been deleted' do
|
||||
post = Fabricate(:post, raw: "<img src='#{image_url}'>")
|
||||
post.topic.destroy!
|
||||
|
||||
expect do
|
||||
Jobs::PullHotlinkedImages.new.execute(post_id: post.id)
|
||||
end.to change { Upload.count }.by(0)
|
||||
end
|
||||
|
||||
it 'does nothing if there are no large images to pull' do
|
||||
post = Fabricate(:post, raw: 'bob bob')
|
||||
orig = post.updated_at
|
||||
|
|
Loading…
Reference in New Issue