From 234ac986400eb5803108aa16edf1cef845c00c95 Mon Sep 17 00:00:00 2001 From: nonamethanks Date: Tue, 19 Apr 2022 16:19:46 +0200 Subject: [PATCH] Posts: don't try to ban/unban a post that is already banned/unbanned --- app/models/post.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models/post.rb b/app/models/post.rb index af62cabd4..7793e517e 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -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