@@ -488,7 +488,8 @@ class Post < ActiveRecord::Base
|
|||||||
def update_tag_post_counts
|
def update_tag_post_counts
|
||||||
decrement_tags = tag_array_was - tag_array
|
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")
|
self.errors.add(:updater_id, "must have an account at least 1 week old to remove tags")
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -463,14 +463,20 @@ class PostTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
context "as a new user" do
|
context "as a new user" do
|
||||||
setup 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)
|
CurrentUser.user = FactoryGirl.create(:user)
|
||||||
end
|
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")
|
@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)
|
assert_equal(["You must have an account at least 1 week old to remove tags"], @post.errors.full_messages)
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
context "with a banned artist" do
|
context "with a banned artist" do
|
||||||
|
|||||||
Reference in New Issue
Block a user