PostQueryBuilder: remove useless code.
The workaround for `unaliased:fav:1` is no longer needed since favorites are no longer included in the post's tag_index.
This commit is contained in:
@@ -90,8 +90,6 @@ class PostQueryBuilder
|
|||||||
end
|
end
|
||||||
|
|
||||||
def tags_match(tags, relation)
|
def tags_match(tags, relation)
|
||||||
tsquery = []
|
|
||||||
|
|
||||||
negated_wildcard_tags, negated_tags = tags.select(&:negated).partition(&:wildcard)
|
negated_wildcard_tags, negated_tags = tags.select(&:negated).partition(&:wildcard)
|
||||||
optional_wildcard_tags, optional_tags = tags.select(&:optional).partition(&:wildcard)
|
optional_wildcard_tags, optional_tags = tags.select(&:optional).partition(&:wildcard)
|
||||||
required_wildcard_tags, required_tags = tags.reject(&:negated).reject(&:optional).partition(&:wildcard)
|
required_wildcard_tags, required_tags = tags.reject(&:negated).reject(&:optional).partition(&:wildcard)
|
||||||
@@ -191,7 +189,7 @@ class PostQueryBuilder
|
|||||||
when "ordfav"
|
when "ordfav"
|
||||||
ordfav_matches(value)
|
ordfav_matches(value)
|
||||||
when "unaliased"
|
when "unaliased"
|
||||||
unaliased_matches(value)
|
tags_include(value)
|
||||||
when "exif"
|
when "exif"
|
||||||
exif_matches(value)
|
exif_matches(value)
|
||||||
when "user"
|
when "user"
|
||||||
@@ -234,15 +232,6 @@ class PostQueryBuilder
|
|||||||
Post.where_array_includes_all("string_to_array(posts.tag_string, ' ')", tags)
|
Post.where_array_includes_all("string_to_array(posts.tag_string, ' ')", tags)
|
||||||
end
|
end
|
||||||
|
|
||||||
def unaliased_matches(tag)
|
|
||||||
# don't let users use unaliased:fav:1 to view private favorites
|
|
||||||
if tag =~ /\Afav:\d+\z/
|
|
||||||
Post.none
|
|
||||||
else
|
|
||||||
tags_include(tag)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def exif_matches(string)
|
def exif_matches(string)
|
||||||
# string = exif:File:ColorComponents=3
|
# string = exif:File:ColorComponents=3
|
||||||
if string.include?("=")
|
if string.include?("=")
|
||||||
|
|||||||
Reference in New Issue
Block a user