Posts: don't try to ban/unban a post that is already banned/unbanned

This commit is contained in:
nonamethanks
2022-04-19 16:19:46 +02:00
parent c5e6044c23
commit 234ac98640

View File

@@ -824,11 +824,13 @@ class Post < ApplicationRecord
end
def ban!
return if is_banned?
update_column(:is_banned, true)
ModAction.log("banned post ##{id}", :post_ban)
end
def unban!
return unless is_banned?
update_column(:is_banned, false)
ModAction.log("unbanned post ##{id}", :post_unban)
end