Fix #4603: Total Upload Limit Being Reduced After A Failed Appeal

This commit is contained in:
evazion
2021-06-28 06:04:14 -05:00
parent 000653d840
commit 4b6e706e5e
5 changed files with 51 additions and 11 deletions

View File

@@ -1003,7 +1003,7 @@ class Post < ApplicationRecord
# XXX This must happen *after* the `is_deleted` flag is set to true (issue #3419).
give_favorites_to_parent if move_favorites
uploader.upload_limit.update_limit!(self, incremental: automated)
uploader.upload_limit.update_limit!(is_pending?, false)
unless automated
ModAction.log("deleted post ##{id}, reason: #{reason}", :post_delete)

View File

@@ -26,6 +26,7 @@ class PostApproval < ApplicationRecord
end
def approve_post
is_pending = post.is_pending
is_undeletion = post.is_deleted
post.flags.pending.update!(status: :rejected)
@@ -34,7 +35,7 @@ class PostApproval < ApplicationRecord
post.update(approver: user, is_flagged: false, is_pending: false, is_deleted: false)
ModAction.log("undeleted post ##{post_id}", :post_undelete) if is_undeletion
post.uploader.upload_limit.update_limit!(post, incremental: !is_undeletion)
post.uploader.upload_limit.update_limit!(is_pending, true)
end
def self.search(params)