diff --git a/app/jobs/regular/pull_hotlinked_images.rb b/app/jobs/regular/pull_hotlinked_images.rb index ad323923737..9016de6d561 100644 --- a/app/jobs/regular/pull_hotlinked_images.rb +++ b/app/jobs/regular/pull_hotlinked_images.rb @@ -8,8 +8,7 @@ module Jobs end def execute(args) - # we don't want to run the job if we're not allowed to crawl images - return unless SiteSetting.crawl_images? + return unless SiteSetting.download_remote_images_to_local? post_id = args[:post_id] raise Discourse::InvalidParameters.new(:post_id) unless post_id.present? diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 50918dd6a02..ee6e3b6badc 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -500,6 +500,7 @@ en: company_domain: "The domain name owned by the company that runs this site, used in legal documents like the /tos" queue_jobs: "DEVELOPER ONLY! WARNING! By default, queue jobs in sidekiq. If disabled, your site will be broken." crawl_images: "Enable retrieving images from third party sources to insert width and height dimensions" + download_remote_images_to_local: "Download a copy of all remote images" ninja_edit_window: "Number of seconds after posting where edits do not create a new version" edit_history_visible_to_public: "Allow everyone to see previous versions of an edited post. When disabled, only staff members can view edit history." delete_removed_posts_after: "Number of hours after which posts removed by the author will be deleted." diff --git a/config/site_settings.yml b/config/site_settings.yml index 98de4abf81b..480a2f2fd42 100644 --- a/config/site_settings.yml +++ b/config/site_settings.yml @@ -249,6 +249,10 @@ files: default: false detect_custom_avatars: true max_daily_gravatar_crawls: 500 + download_remote_images_to_local: + default: + test: false + default: true trust: default_trust_level: 0 diff --git a/lib/cooked_post_processor.rb b/lib/cooked_post_processor.rb index c794b793a69..fd580e37c4e 100644 --- a/lib/cooked_post_processor.rb +++ b/lib/cooked_post_processor.rb @@ -219,8 +219,8 @@ class CookedPostProcessor end def pull_hotlinked_images - # we don't want to run the job if we're not allowed to crawl images - return unless SiteSetting.crawl_images? + # is the job enabled? + return unless SiteSetting.download_remote_images_to_local? # we only want to run the job whenever it's changed by a user return if @post.updated_by == Discourse.system_user # make sure no other job is scheduled diff --git a/spec/components/cooked_post_processor_spec.rb b/spec/components/cooked_post_processor_spec.rb index b759d85b632..ff8ad2d394d 100644 --- a/spec/components/cooked_post_processor_spec.rb +++ b/spec/components/cooked_post_processor_spec.rb @@ -275,15 +275,15 @@ describe CookedPostProcessor do let(:post) { build(:post) } let(:cpp) { CookedPostProcessor.new(post) } - it "does not run when crawl images is disabled" do - SiteSetting.stubs(:crawl_images).returns(false) + it "does not run when download_remote_images_to_local is disabled" do + SiteSetting.stubs(:download_remote_images_to_local).returns(false) Jobs.expects(:cancel_scheduled_job).never cpp.pull_hotlinked_images end - context "when crawl_images? is enabled" do + context "when download_remote_images_to_local? is enabled" do - before { SiteSetting.stubs(:crawl_images).returns(true) } + before { SiteSetting.stubs(:download_remote_images_to_local).returns(true) } it "runs only when a user updated the post" do post.updated_by = Discourse.system_user