FIX: Always schedule pull_hotlinked_images in cooked_post_processor
The job is now used to pull optimized images, and images from other sites on the same CDN. This needs to run even if download_remote_images is false
This commit is contained in:
parent
54afa314fb
commit
65b0cafc03
|
@ -626,8 +626,6 @@ class CookedPostProcessor
|
|||
end
|
||||
|
||||
def pull_hotlinked_images(bypass_bump = false)
|
||||
# is the job enabled?
|
||||
return unless SiteSetting.download_remote_images_to_local?
|
||||
# have we enough disk space?
|
||||
return if disable_if_low_on_disk_space
|
||||
# don't download remote images for posts that are more than n days old
|
||||
|
|
|
@ -1082,10 +1082,11 @@ describe CookedPostProcessor do
|
|||
|
||||
before { cpp.stubs(:available_disk_space).returns(90) }
|
||||
|
||||
it "does not run when download_remote_images_to_local is disabled" do
|
||||
it "runs even when download_remote_images_to_local is disabled" do
|
||||
# We want to run it to pull hotlinked optimized images
|
||||
SiteSetting.download_remote_images_to_local = false
|
||||
Jobs.expects(:cancel_scheduled_job).never
|
||||
cpp.pull_hotlinked_images
|
||||
expect { cpp.pull_hotlinked_images }.
|
||||
to change { Jobs::PullHotlinkedImages.jobs.count }.by 1
|
||||
end
|
||||
|
||||
context "when download_remote_images_to_local? is enabled" do
|
||||
|
|
Loading…
Reference in New Issue