Merge branch 'master' into attribute-searching

This commit is contained in:
evazion
2020-08-17 14:23:00 -05:00
committed by GitHub
155 changed files with 2834 additions and 2169 deletions

View File

@@ -12,7 +12,7 @@ class PostApproval < ApplicationRecord
errors.add(:post, "is locked and cannot be approved")
end
if post.status == "active"
if post.is_active?
errors.add(:post, "is already active and cannot be approved")
end
@@ -28,7 +28,9 @@ class PostApproval < ApplicationRecord
def approve_post
is_undeletion = post.is_deleted
post.flags.each(&:resolve!)
post.flags.pending.update!(status: :rejected)
post.appeals.pending.update!(status: :succeeded)
post.update(approver: user, is_flagged: false, is_pending: false, is_deleted: false)
ModAction.log("undeleted post ##{post_id}", :post_undelete) if is_undeletion