mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 09:26:54 -06:00
REFACTOR: Load Post
records in batches when destroying stubs.
This commit is contained in:
parent
6f7c6b0fd0
commit
aef89c4850
@ -13,6 +13,8 @@ class PostDestroyer
|
||||
end
|
||||
|
||||
def self.destroy_stubs
|
||||
context = I18n.t('remove_posts_deleted_by_author')
|
||||
|
||||
# exclude deleted topics and posts that are actively flagged
|
||||
Post.where(deleted_at: nil, user_deleted: true)
|
||||
.where("NOT EXISTS (
|
||||
@ -28,8 +30,9 @@ class PostDestroyer
|
||||
pa.deleted_at IS NULL AND
|
||||
pa.post_action_type_id IN (?)
|
||||
)", PostActionType.notify_flag_type_ids)
|
||||
.each do |post|
|
||||
PostDestroyer.new(Discourse.system_user, post, {context: I18n.t('remove_posts_deleted_by_author')}).destroy
|
||||
.find_each do |post|
|
||||
|
||||
PostDestroyer.new(Discourse.system_user, post, context: context).destroy
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -467,4 +467,3 @@ describe PostDestroyer do
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user