diff --git a/app/models/post.rb b/app/models/post.rb index c5c7099f0..076bbaebc 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -614,6 +614,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 d78c34ebc..1ce050ca8 100644 --- a/test/unit/post_test.rb +++ b/test/unit/post_test.rb @@ -668,6 +668,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