mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 09:42:07 +08:00
DEV: Remove bypass_bump
from CookedPostProcessor (#9468)
It was only passing it along to `PullHotlinkedImages` and that class have not used that arg since April 2014 (c52ee665b4
)
This commit is contained in:
parent
9a6e4b1fa1
commit
5a81e3999c
|
@ -23,7 +23,7 @@ module Jobs
|
||||||
end
|
end
|
||||||
|
|
||||||
cp = CookedPostProcessor.new(post, args)
|
cp = CookedPostProcessor.new(post, args)
|
||||||
cp.post_process(bypass_bump: args[:bypass_bump], new_post: args[:new_post])
|
cp.post_process(new_post: args[:new_post])
|
||||||
|
|
||||||
# If we changed the document, save it
|
# If we changed the document, save it
|
||||||
cooked = cp.html
|
cooked = cp.html
|
||||||
|
|
|
@ -32,7 +32,7 @@ class CookedPostProcessor
|
||||||
@omit_nofollow = post.omit_nofollow?
|
@omit_nofollow = post.omit_nofollow?
|
||||||
end
|
end
|
||||||
|
|
||||||
def post_process(bypass_bump: false, new_post: false)
|
def post_process(new_post: false)
|
||||||
DistributedMutex.synchronize("post_process_#{@post.id}", validity: 10.minutes) do
|
DistributedMutex.synchronize("post_process_#{@post.id}", validity: 10.minutes) do
|
||||||
DiscourseEvent.trigger(:before_post_process_cooked, @doc, @post)
|
DiscourseEvent.trigger(:before_post_process_cooked, @doc, @post)
|
||||||
remove_full_quote_on_direct_reply if new_post
|
remove_full_quote_on_direct_reply if new_post
|
||||||
|
@ -43,7 +43,7 @@ class CookedPostProcessor
|
||||||
remove_user_ids
|
remove_user_ids
|
||||||
update_post_image
|
update_post_image
|
||||||
enforce_nofollow
|
enforce_nofollow
|
||||||
pull_hotlinked_images(bypass_bump)
|
pull_hotlinked_images
|
||||||
grant_badges
|
grant_badges
|
||||||
@post.link_post_uploads(fragments: @doc)
|
@post.link_post_uploads(fragments: @doc)
|
||||||
DiscourseEvent.trigger(:post_process_cooked, @doc, @post)
|
DiscourseEvent.trigger(:post_process_cooked, @doc, @post)
|
||||||
|
@ -655,7 +655,7 @@ class CookedPostProcessor
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def pull_hotlinked_images(bypass_bump = false)
|
def pull_hotlinked_images
|
||||||
# have we enough disk space?
|
# have we enough disk space?
|
||||||
disable_if_low_on_disk_space # But still enqueue the job
|
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
|
# don't download remote images for posts that are more than n days old
|
||||||
|
@ -666,7 +666,7 @@ class CookedPostProcessor
|
||||||
Jobs.cancel_scheduled_job(:pull_hotlinked_images, post_id: @post.id)
|
Jobs.cancel_scheduled_job(:pull_hotlinked_images, post_id: @post.id)
|
||||||
# schedule the job
|
# schedule the job
|
||||||
delay = SiteSetting.editing_grace_period + 1
|
delay = SiteSetting.editing_grace_period + 1
|
||||||
Jobs.enqueue_in(delay.seconds.to_i, :pull_hotlinked_images, post_id: @post.id, bypass_bump: bypass_bump)
|
Jobs.enqueue_in(delay.seconds.to_i, :pull_hotlinked_images, post_id: @post.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def disable_if_low_on_disk_space
|
def disable_if_low_on_disk_space
|
||||||
|
|
|
@ -1529,7 +1529,7 @@ describe CookedPostProcessor do
|
||||||
Jobs.expects(:cancel_scheduled_job).with(:pull_hotlinked_images, post_id: post.id).once
|
Jobs.expects(:cancel_scheduled_job).with(:pull_hotlinked_images, post_id: post.id).once
|
||||||
|
|
||||||
delay = SiteSetting.editing_grace_period + 1
|
delay = SiteSetting.editing_grace_period + 1
|
||||||
Jobs.expects(:enqueue_in).with(delay.seconds, :pull_hotlinked_images, post_id: post.id, bypass_bump: false).once
|
Jobs.expects(:enqueue_in).with(delay.seconds, :pull_hotlinked_images, post_id: post.id).once
|
||||||
|
|
||||||
cpp.pull_hotlinked_images
|
cpp.pull_hotlinked_images
|
||||||
end
|
end
|
||||||
|
@ -1603,7 +1603,7 @@ describe CookedPostProcessor do
|
||||||
Jobs.expects(:cancel_scheduled_job).with(:pull_hotlinked_images, post_id: post.id).once
|
Jobs.expects(:cancel_scheduled_job).with(:pull_hotlinked_images, post_id: post.id).once
|
||||||
|
|
||||||
delay = SiteSetting.editing_grace_period + 1
|
delay = SiteSetting.editing_grace_period + 1
|
||||||
Jobs.expects(:enqueue_in).with(delay.seconds, :pull_hotlinked_images, post_id: post.id, bypass_bump: false).once
|
Jobs.expects(:enqueue_in).with(delay.seconds, :pull_hotlinked_images, post_id: post.id).once
|
||||||
|
|
||||||
cpp.pull_hotlinked_images
|
cpp.pull_hotlinked_images
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user