From 0754206031a9136d87528795edf2552af1ceca99 Mon Sep 17 00:00:00 2001 From: r888888888 Date: Tue, 16 Apr 2013 22:24:36 -0700 Subject: [PATCH] fixes #1270 --- app/models/post.rb | 2 +- test/unit/post_test.rb | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/models/post.rb b/app/models/post.rb index d1b769c00..70a9d8e18 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -817,7 +817,7 @@ class Post < ActiveRecord::Base update_column(:is_deleted, true) update_column(:is_pending, false) update_column(:is_flagged, false) - update_column(:is_banned, true) if options[:ban] + update_column(:is_banned, true) if options[:ban] || has_tag?("banned_artist") unless options[:without_mod_action] ModAction.create(:description => "deleted post ##{id}") diff --git a/test/unit/post_test.rb b/test/unit/post_test.rb index 07ddce06b..c4b12771c 100644 --- a/test/unit/post_test.rb +++ b/test/unit/post_test.rb @@ -56,6 +56,15 @@ class PostTest < ActiveSupport::TestCase end end + context "with the banned_artist tag" do + should "also ban the post" do + post = FactoryGirl.create(:post, :tag_string => "banned_artist") + post.delete! + post.reload + assert(post.is_banned?) + end + end + should "update the fast count" do post = FactoryGirl.create(:post, :tag_string => "aaa") assert_equal(1, Post.fast_count)