Post#approve!: move approving logic to post_approval.rb.

This commit is contained in:
evazion
2017-04-03 13:30:13 -05:00
parent 258fc37bfe
commit db0bcf08b9
2 changed files with 10 additions and 14 deletions

View File

@@ -321,20 +321,8 @@ class Post < ActiveRecord::Base
end
end
def approve!
flags.each {|x| x.resolve!}
self.is_flagged = false
self.is_pending = false
self.is_deleted = false
self.approver_id = CurrentUser.id
PostApproval.create(user_id: CurrentUser.id, post_id: id)
if is_deleted_was == true
ModAction.log("undeleted post ##{id}")
end
save!
def approve!(approver = CurrentUser.user)
approvals.create!(user: approver)
end
def approved_by?(user)