mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Always link post to uploads in post process.
The operation is cheap anyway so no point skipping.
This commit is contained in:
parent
b6a139b581
commit
d4b05d7bc5
@ -650,11 +650,10 @@ class Post < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Enqueue post processing for this post
|
# Enqueue post processing for this post
|
||||||
def trigger_post_process(bypass_bump: false, skip_link_post_uploads: false)
|
def trigger_post_process(bypass_bump: false)
|
||||||
args = {
|
args = {
|
||||||
post_id: id,
|
post_id: id,
|
||||||
bypass_bump: bypass_bump,
|
bypass_bump: bypass_bump,
|
||||||
skip_link_post_uploads: skip_link_post_uploads
|
|
||||||
}
|
}
|
||||||
args[:image_sizes] = image_sizes if image_sizes.present?
|
args[:image_sizes] = image_sizes if image_sizes.present?
|
||||||
args[:invalidate_oneboxes] = true if invalidate_oneboxes.present?
|
args[:invalidate_oneboxes] = true if invalidate_oneboxes.present?
|
||||||
|
@ -35,16 +35,12 @@ class CookedPostProcessor
|
|||||||
post_process_oneboxes
|
post_process_oneboxes
|
||||||
post_process_images
|
post_process_images
|
||||||
post_process_quotes
|
post_process_quotes
|
||||||
|
|
||||||
unless @opts[:skip_link_post_uploads]
|
|
||||||
@post.link_post_uploads(fragments: @doc)
|
|
||||||
end
|
|
||||||
|
|
||||||
optimize_urls
|
optimize_urls
|
||||||
update_post_image
|
update_post_image
|
||||||
enforce_nofollow
|
enforce_nofollow
|
||||||
pull_hotlinked_images(bypass_bump)
|
pull_hotlinked_images(bypass_bump)
|
||||||
grant_badges
|
grant_badges
|
||||||
|
@post.link_post_uploads(fragments: @doc)
|
||||||
DiscourseEvent.trigger(:post_process_cooked, @doc, @post)
|
DiscourseEvent.trigger(:post_process_cooked, @doc, @post)
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
@ -189,7 +189,7 @@ class PostCreator
|
|||||||
publish
|
publish
|
||||||
|
|
||||||
track_latest_on_category
|
track_latest_on_category
|
||||||
enqueue_jobs(skip_link_post_uploads: true) unless @opts[:skip_jobs]
|
enqueue_jobs unless @opts[:skip_jobs]
|
||||||
BadgeGranter.queue_badge_grant(Badge::Trigger::PostRevision, post: @post)
|
BadgeGranter.queue_badge_grant(Badge::Trigger::PostRevision, post: @post)
|
||||||
|
|
||||||
trigger_after_events unless opts[:skip_events]
|
trigger_after_events unless opts[:skip_events]
|
||||||
@ -214,13 +214,12 @@ class PostCreator
|
|||||||
@post
|
@post
|
||||||
end
|
end
|
||||||
|
|
||||||
def enqueue_jobs(skip_link_post_uploads: false)
|
def enqueue_jobs
|
||||||
return unless @post && !@post.errors.present?
|
return unless @post && !@post.errors.present?
|
||||||
|
|
||||||
PostJobsEnqueuer.new(@post, @topic, new_topic?,
|
PostJobsEnqueuer.new(@post, @topic, new_topic?,
|
||||||
import_mode: @opts[:import_mode],
|
import_mode: @opts[:import_mode],
|
||||||
post_alert_options: @opts[:post_alert_options],
|
post_alert_options: @opts[:post_alert_options]
|
||||||
skip_link_post_uploads: skip_link_post_uploads
|
|
||||||
).enqueue_jobs
|
).enqueue_jobs
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -38,9 +38,7 @@ class PostJobsEnqueuer
|
|||||||
end
|
end
|
||||||
|
|
||||||
def trigger_post_post_process
|
def trigger_post_post_process
|
||||||
@post.trigger_post_process(
|
@post.trigger_post_process
|
||||||
skip_link_post_uploads: @opts[:skip_link_post_uploads]
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def after_post_create
|
def after_post_create
|
||||||
|
@ -193,7 +193,6 @@ describe PostCreator do
|
|||||||
topic_id = post.topic_id
|
topic_id = post.topic_id
|
||||||
|
|
||||||
process_post_args = Jobs::ProcessPost.jobs.first["args"].first
|
process_post_args = Jobs::ProcessPost.jobs.first["args"].first
|
||||||
expect(process_post_args["skip_link_post_uploads"]).to eq(true)
|
|
||||||
expect(process_post_args["post_id"]).to eq(post_id)
|
expect(process_post_args["post_id"]).to eq(post_id)
|
||||||
|
|
||||||
feature_topic_users_args = Jobs::FeatureTopicUsers.jobs.first["args"].first
|
feature_topic_users_args = Jobs::FeatureTopicUsers.jobs.first["args"].first
|
||||||
|
Loading…
Reference in New Issue
Block a user