diff --git a/app/logical/post_query_builder.rb b/app/logical/post_query_builder.rb index fc013c192..52b0abe7b 100644 --- a/app/logical/post_query_builder.rb +++ b/app/logical/post_query_builder.rb @@ -54,19 +54,19 @@ class PostQueryBuilder tag_query_sql = [] if tags[:include].any? - raise ::Post::SearchError.new("You cannot search for more than #{CurrentUser.tag_query_limit} tags at a time") if tags[:include].size > CurrentUser.tag_query_limit + raise ::Post::SearchError.new("You cannot search for more than #{CurrentUser.user.tag_query_limit} tags at a time") if tags[:include].size > CurrentUser.user.tag_query_limit tag_query_sql << "(" + escape_string_for_tsquery(tags[:include]).join(" | ") + ")" has_constraints! end if tags[:related].any? - raise ::Post::SearchError.new("You cannot search for more than #{CurrentUser.tag_query_limit} tags at a time") if tags[:related].size > CurrentUser.tag_query_limit + raise ::Post::SearchError.new("You cannot search for more than #{CurrentUser.user.tag_query_limit} tags at a time") if tags[:related].size > CurrentUser.user.tag_query_limit tag_query_sql << "(" + escape_string_for_tsquery(tags[:related]).join(" & ") + ")" has_constraints! end if tags[:exclude].any? - raise ::Post::SearchError.new("You cannot search for more than #{CurrentUser.tag_query_limit} tags at a time") if tags[:exclude].size > CurrentUser.tag_query_limit + raise ::Post::SearchError.new("You cannot search for more than #{CurrentUser.user.tag_query_limit} tags at a time") if tags[:exclude].size > CurrentUse.userr.tag_query_limit raise ::Post::SearchError.new("You cannot search for only excluded tags") unless has_constraints? tag_query_sql << "!(" + escape_string_for_tsquery(tags[:exclude]).join(" | ") + ")" diff --git a/app/models/tag.rb b/app/models/tag.rb index 9b9bc5773..dfce9d98c 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -210,7 +210,7 @@ class Tag < ActiveRecord::Base output[:include] << tag[1..-1] elsif tag =~ /\*/ - matches = Tag.name_matches(tag).all(:select => "name", :limit => CurrentUser.tag_query_limit, :order => "post_count DESC").map(&:name) + matches = Tag.name_matches(tag).all(:select => "name", :limit => CurrentUser.user.tag_query_limit, :order => "post_count DESC").map(&:name) matches = ["~no_matches~"] if matches.empty? output[:include] += matches diff --git a/app/presenters/post_set_presenters/post.rb b/app/presenters/post_set_presenters/post.rb index 1db6bb9cc..d4d076c67 100644 --- a/app/presenters/post_set_presenters/post.rb +++ b/app/presenters/post_set_presenters/post.rb @@ -36,7 +36,7 @@ module PostSetPresenters end def pattern_tags - Tag.name_matches(post_set.tag_string).all(:select => "name", :limit => CurrentUser.tag_query_limit, :order => "post_count DESC").map(&:name) + Tag.name_matches(post_set.tag_string).all(:select => "name", :limit => CurrentUser.user.tag_query_limit, :order => "post_count DESC").map(&:name) end def related_tags_for_group