change privileged accounts to gold accounts, add platinum accounts, add favorite and tag query limiting based on level

This commit is contained in:
albert
2013-02-20 00:02:43 -05:00
parent 8fb20c6b3a
commit 66fc05e30b
9 changed files with 63 additions and 12 deletions

View File

@@ -49,24 +49,24 @@ class PostQueryBuilder
"''" + escaped_token + "''"
end
end
def add_tag_string_search_relation(tags, relation)
tag_query_sql = []
if tags[:include].any?
raise ::Post::SearchError.new("You cannot search for more than #{Danbooru.config.tag_query_limit} tags at a time") if tags[:include].size > Danbooru.config.tag_query_limit
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
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 #{Danbooru.config.tag_query_limit} tags at a time") if tags[:related].size > Danbooru.config.tag_query_limit
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
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 #{Danbooru.config.tag_query_limit} tags at a time") if tags[:exclude].size > Danbooru.config.tag_query_limit
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 only excluded tags") unless has_constraints?
tag_query_sql << "!(" + escape_string_for_tsquery(tags[:exclude]).join(" | ") + ")"