fixes #321
This commit is contained in:
@@ -15,8 +15,9 @@ class Comment < ActiveRecord::Base
|
||||
scope :visible, lambda {|user| where("score >= ?", user.comment_threshold)}
|
||||
scope :post_tag_match, lambda {|query| joins(:post).where("posts.tag_index @@ to_tsquery('danbooru', ?)", query)}
|
||||
scope :for_user, lambda {|user_id| where("creator_id = ?", user_id)}
|
||||
scope :for_user_name, lambda {|user_name| where("creator_id = (select _.id from users _ where lower(_.name) = lower(?))", user_name)}
|
||||
|
||||
search_methods :body_matches, :post_tag_match
|
||||
search_methods :body_matches, :post_tag_match, :for_user_name
|
||||
|
||||
def initialize_creator
|
||||
self.creator_id = CurrentUser.user.id
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<%= simple_form_for(@search) do |f| %>
|
||||
<%= hidden_field_tag "group_by", "comment" %>
|
||||
<%= f.input :body_matches, :label => "Body", :required => false %>
|
||||
<%= f.input :creator_name_equals, :label => "User", :required => false %>
|
||||
<%= f.input :for_user_name, :label => "User", :required => false %>
|
||||
<%= f.input :post_tag_match, :label => "Tags", :required => false %>
|
||||
|
||||
<%= f.button :submit, "Search" %>
|
||||
|
||||
Reference in New Issue
Block a user