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:
@@ -663,12 +663,11 @@ class CookedPostProcessor
|
||||
end
|
||||
|
||||
def pull_hotlinked_images
|
||||
return if @opts[:skip_pull_hotlinked_images]
|
||||
# have we enough disk space?
|
||||
disable_if_low_on_disk_space # But still enqueue the job
|
||||
# don't download remote images for posts that are more than n days old
|
||||
return unless @post.created_at > (Date.today - SiteSetting.download_remote_images_max_days_old)
|
||||
# we only want to run the job whenever it's changed by a user
|
||||
return if @post.last_editor_id && @post.last_editor_id <= 0
|
||||
# make sure no other job is scheduled
|
||||
Jobs.cancel_scheduled_job(:pull_hotlinked_images, post_id: @post.id)
|
||||
# schedule the job
|
||||
|
||||
Reference in New Issue
Block a user