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:
@@ -824,11 +824,13 @@ class Post < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def ban!
|
def ban!
|
||||||
|
return if is_banned?
|
||||||
update_column(:is_banned, true)
|
update_column(:is_banned, true)
|
||||||
ModAction.log("banned post ##{id}", :post_ban)
|
ModAction.log("banned post ##{id}", :post_ban)
|
||||||
end
|
end
|
||||||
|
|
||||||
def unban!
|
def unban!
|
||||||
|
return unless is_banned?
|
||||||
update_column(:is_banned, false)
|
update_column(:is_banned, false)
|
||||||
ModAction.log("unbanned post ##{id}", :post_unban)
|
ModAction.log("unbanned post ##{id}", :post_unban)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user