BURs: remove old single alias/implication pruning code.
* Rename TagChangeRequestPruner to BulkUpdateRequestPruner. * Remove old code for pruning individual alias / implication requests.
This commit is contained in:
27
app/logical/bulk_update_request_pruner.rb
Normal file
27
app/logical/bulk_update_request_pruner.rb
Normal file
@@ -0,0 +1,27 @@
|
||||
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
|
||||
Reference in New Issue
Block a user