Files
danbooru/app/logical/bulk_update_request_pruner.rb
evazion 6fecf5db0e BURs: remove old single alias/implication pruning code.
* Rename TagChangeRequestPruner to BulkUpdateRequestPruner.
* Remove old code for pruning individual alias / implication requests.
2020-03-10 21:23:46 -05:00

28 lines
889 B
Ruby

module BulkUpdateRequestPruner
module_function
def warn_old
BulkUpdateRequest.old.pending.find_each do |bulk_update_request|
if bulk_update_request.forum_topic
body = "This bulk update request is pending automatic rejection in 5 days."
unless bulk_update_request.forum_topic.posts.where(creator_id: User.system.id, body: body).exists?
bulk_update_request.forum_updater.update(body)
end
end
end
end
def reject_expired
BulkUpdateRequest.expired.pending.find_each do |bulk_update_request|
ApplicationRecord.transaction do
if bulk_update_request.forum_topic
body = "This bulk update request has been rejected because it was not approved within 60 days."
bulk_update_request.forum_updater.update(body)
end
bulk_update_request.reject!(User.system)
end
end
end
end