/post_{flags,appeals}: allow searching by tags.
This commit is contained in:
@@ -16,6 +16,10 @@ class PostAppeal < ActiveRecord::Base
|
||||
where("reason ILIKE ? ESCAPE E'\\\\'", query.to_escaped_for_sql_like)
|
||||
end
|
||||
|
||||
def post_tags_match(query)
|
||||
PostQueryBuilder.new(query).build(self.joins(:post))
|
||||
end
|
||||
|
||||
def resolved
|
||||
joins(:post).where("posts.is_deleted = false and posts.is_flagged = false")
|
||||
end
|
||||
@@ -56,6 +60,10 @@ class PostAppeal < ActiveRecord::Base
|
||||
q = q.where("post_id = ?", params[:post_id].to_i)
|
||||
end
|
||||
|
||||
if params[:post_tags_match].present?
|
||||
q = q.post_tags_match(params[:post_tags_match])
|
||||
end
|
||||
|
||||
if params[:is_resolved] == "true"
|
||||
q = q.resolved
|
||||
elsif params[:is_resolved] == "false"
|
||||
|
||||
@@ -24,6 +24,10 @@ class PostFlag < ActiveRecord::Base
|
||||
where("reason ILIKE ? ESCAPE E'\\\\'", query.to_escaped_for_sql_like)
|
||||
end
|
||||
|
||||
def post_tags_match(query)
|
||||
PostQueryBuilder.new(query).build(self.joins(:post))
|
||||
end
|
||||
|
||||
def resolved
|
||||
where("is_resolved = ?", true)
|
||||
end
|
||||
@@ -64,6 +68,10 @@ class PostFlag < ActiveRecord::Base
|
||||
q = q.where("post_id = ?", params[:post_id].to_i)
|
||||
end
|
||||
|
||||
if params[:post_tags_match].present?
|
||||
q = q.post_tags_match(params[:post_tags_match])
|
||||
end
|
||||
|
||||
if params[:is_resolved] == "true"
|
||||
q = q.resolved
|
||||
elsif params[:is_resolved] == "false"
|
||||
|
||||
Reference in New Issue
Block a user