diff --git a/app/models/post.rb b/app/models/post.rb index 73efe797e..2adf8352c 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -615,6 +615,7 @@ class Post < ActiveRecord::Base def remove_negated_tags(tags) negated_tags, tags = tags.partition {|x| x =~ /\A-/i} negated_tags = negated_tags.map {|x| x[1..-1]} + negated_tags = TagAlias.to_aliased(negated_tags) return tags - negated_tags end diff --git a/test/unit/post_test.rb b/test/unit/post_test.rb index 8fddae6b4..79ead2b17 100644 --- a/test/unit/post_test.rb +++ b/test/unit/post_test.rb @@ -740,6 +740,13 @@ class PostTest < ActiveSupport::TestCase @post.reload assert_equal("aaa ccc", @post.tag_string) end + + should "resolve aliases" do + FactoryGirl.create(:tag_alias, :antecedent_name => "/tr", :consequent_name => "translation_request") + @post.update(:tag_string => "aaa translation_request -/tr") + + assert_equal("aaa", @post.tag_string) + end end should "have an array representation of its tags" do