new rake task to defer all flags
This commit is contained in:
parent
8b7089c126
commit
041ace5d3b
|
@ -202,3 +202,23 @@ task 'posts:delete_all_likes' => :environment do
|
|||
DirectoryItem.update_all(likes_given: 0, likes_received: 0) # clear user directory likes stats
|
||||
puts "", "#{likes_deleted} likes deleted!", ""
|
||||
end
|
||||
|
||||
desc 'Defer all flags'
|
||||
task 'posts:defer_all_flags' => :environment do
|
||||
|
||||
active_flags = FlagQuery.flagged_post_actions('active')
|
||||
|
||||
flags_deferred = 0
|
||||
total = active_flags.count
|
||||
|
||||
active_flags.each do |post_action|
|
||||
begin
|
||||
PostAction.defer_flags!(Post.find(post_action.post_id), Discourse.system_user)
|
||||
print_status(flags_deferred += 1, total)
|
||||
rescue
|
||||
# skip
|
||||
end
|
||||
end
|
||||
|
||||
puts "", "#{flags_deferred} flags deferred!", ""
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue