posts: remove unused flag! and approve! methods.
These methods were unused outside of the test suite
This commit is contained in:
@@ -254,18 +254,6 @@ class Post < ApplicationRecord
|
||||
!is_active? && uploader != user
|
||||
end
|
||||
|
||||
def flag!(reason, is_deletion: false)
|
||||
flag = flags.create(reason: reason, is_deletion: is_deletion, creator: CurrentUser.user)
|
||||
|
||||
if flag.errors.any?
|
||||
raise PostFlag::Error, flag.errors.full_messages.join("; ")
|
||||
end
|
||||
end
|
||||
|
||||
def approve!(approver = CurrentUser.user)
|
||||
approvals.create(user: approver)
|
||||
end
|
||||
|
||||
def disapproved_by?(user)
|
||||
PostDisapproval.exists?(user_id: user.id, post_id: id)
|
||||
end
|
||||
|
||||
@@ -29,7 +29,7 @@ class PostApproval < ApplicationRecord
|
||||
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
|
||||
ModAction.log("undeleted post ##{post_id}", :post_undelete, user) if is_undeletion
|
||||
|
||||
post.uploader.upload_limit.update_limit!(is_pending, true)
|
||||
end
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
class PostFlag < ApplicationRecord
|
||||
class Error < StandardError; end
|
||||
|
||||
module Reasons
|
||||
UNAPPROVED = "Unapproved in three days"
|
||||
REJECTED = "Unapproved in three days after returning to moderation queue%"
|
||||
|
||||
Reference in New Issue
Block a user