diff --git a/app/models/post.rb b/app/models/post.rb index b5824c0e6..78770ca55 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -488,7 +488,8 @@ class Post < ActiveRecord::Base def update_tag_post_counts decrement_tags = tag_array_was - tag_array - if decrement_tags.size > 1 && !CurrentUser.is_builder? && CurrentUser.created_at > 1.week.ago + decrement_tags_except_requests = decrement_tags.reject {|tag| tag == "tagme" || tag.end_with?("_request")} + if decrement_tags_except_requests.size > 0 && !CurrentUser.is_builder? && CurrentUser.created_at > 1.week.ago self.errors.add(:updater_id, "must have an account at least 1 week old to remove tags") return false end diff --git a/test/unit/post_test.rb b/test/unit/post_test.rb index 280e21de0..16a439993 100644 --- a/test/unit/post_test.rb +++ b/test/unit/post_test.rb @@ -463,14 +463,20 @@ class PostTest < ActiveSupport::TestCase context "as a new user" do setup do - @post.update_attribute(:tag_string, "aaa bbb ccc ddd") + @post.update_attribute(:tag_string, "aaa bbb ccc ddd tagme") CurrentUser.user = FactoryGirl.create(:user) end - should "not allow you to remove more than 2 tags" do + should "not allow you to remove tags" do @post.update_attributes(:tag_string => "aaa") assert_equal(["You must have an account at least 1 week old to remove tags"], @post.errors.full_messages) end + + should "allow you to remove request tags" do + @post.update_attributes(:tag_string => "aaa bbb ccc ddd") + @post.reload + assert_equal("aaa bbb ccc ddd", @post.tag_string) + end end context "with a banned artist" do