mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Pull hotlinked images even when edited by system users (#9890)
Previously the pull hotlinked images job was skipped after system edits. This ensured that we never had an infinite loop of system-edit/pull-hotlinked/system-edit/pull-hotlinked etc. A side effect was that edits made by system for any other reason (e.g. API, removing full quotes) would prevent pulling hotlinked images. This commit removes the system edit check, and replaces it with another method to avoid an infinite job scheduling loop.
This commit is contained in:
@@ -1485,16 +1485,14 @@ describe CookedPostProcessor do
|
||||
expect(SiteSetting.download_remote_images_to_local).to eq(false)
|
||||
end
|
||||
|
||||
it "does not run when requested to skip" do
|
||||
CookedPostProcessor.new(post, skip_pull_hotlinked_images: true).pull_hotlinked_images
|
||||
expect(Jobs::PullHotlinkedImages.jobs.size).to eq(0)
|
||||
end
|
||||
|
||||
context "and there is enough disk space" do
|
||||
|
||||
before { cpp.expects(:disable_if_low_on_disk_space) }
|
||||
|
||||
it "does not run when the system user updated the post" do
|
||||
post.last_editor_id = Discourse.system_user.id
|
||||
Jobs.expects(:cancel_scheduled_job).never
|
||||
cpp.pull_hotlinked_images
|
||||
end
|
||||
|
||||
context "and the post has been updated by an actual user" do
|
||||
|
||||
before { post.id = 42 }
|
||||
|
||||
Reference in New Issue
Block a user