Merge pull request #5131 from nonamethanks/fix-mod-action-for-post-ban

Posts: don't try to ban/unban a post that is already banned/unbanned
This commit is contained in:
evazion
2022-04-19 16:37:13 -05:00
committed by GitHub

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