FIX: Undefined method in posts:inline_uploads.

This commit is contained in:
Guo Xiang Tan 2019-06-11 16:28:41 +08:00
parent 40e67971f9
commit 49b921147a

View File

@ -681,15 +681,18 @@ task 'posts:inline_uploads' => :environment do |_, args|
begin begin
new_raw = InlineUploads.process(post.raw) new_raw = InlineUploads.process(post.raw)
byebug
if post.raw != new_raw if post.raw != new_raw
if !dry_run if !dry_run
post.revise!(Discourse.system_user, PostRevisor.new(post, Topic.with_deleted.find_by(id: post.topic_id))
{ .revise!(
raw: new_raw Discourse.system_user,
}, {
skip_validations: true, raw: new_raw
force_new_version: true },
) skip_validations: true,
force_new_version: true
)
end end
if verbose if verbose
@ -701,15 +704,16 @@ task 'posts:inline_uploads' => :environment do |_, args|
elsif dry_run elsif dry_run
putc "🏃" putc "🏃"
else else
putc "." putc "🆗"
end end
fixed_count += 1 fixed_count += 1
else else
putc ""
not_corrected_post_ids << post.id not_corrected_post_ids << post.id
end end
rescue => e rescue => e
putc "X" putc "🚫"
failed_to_correct_post_ids << post.id failed_to_correct_post_ids << post.id
end end
end end