Fix #4168: Ignore validations when rejecting tag changes.
* Only check for conflicts with existing aliases/implications when requests are created or approved, not when requests are rejected. * Use `update!(status: "deleted")` instead of `update(status: "deleted")` so that if rejecting the request fails we fail immediately instead of continuing on and updating the forum topic. * Wrap `reject!` and `TagChangeRequestPruner.reject_expired` in transactions so that if updating either the request or the forum fails, they both get rolled back.
This commit is contained in:
@@ -29,14 +29,16 @@ class TagChangeRequestPruner
|
||||
|
||||
def reject_expired(model)
|
||||
model.expired.pending.find_each do |tag_change|
|
||||
if tag_change.forum_topic
|
||||
name = model.model_name.human.downcase
|
||||
body = "This #{name} has been rejected because it was not approved within 60 days."
|
||||
tag_change.forum_updater.update(body)
|
||||
end
|
||||
transaction do
|
||||
if tag_change.forum_topic
|
||||
name = model.model_name.human.downcase
|
||||
body = "This #{name} has been rejected because it was not approved within 60 days."
|
||||
tag_change.forum_updater.update(body)
|
||||
end
|
||||
|
||||
CurrentUser.as_system do
|
||||
tag_change.reject!
|
||||
CurrentUser.as_system do
|
||||
tag_change.reject!
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user