Merge branch 'master' of github.com:r888888888/danbooru

This commit is contained in:
albert
2013-03-30 12:14:19 -04:00
22 changed files with 52 additions and 28 deletions

View File

@@ -189,6 +189,16 @@ class PostQueryBuilder
has_constraints!
end
if q[:commenter_id]
relation = relation.where(:id => Comment.where("creator_id = ?", q[:commenter_id]).select("post_id").uniq)
has_constraints!
end
if q[:noter_id]
relation = relation.where(:id => Note.where("creator_id = ?", q[:noter_id]).select("post_id").uniq)
has_constraints!
end
if q[:parent_id]
relation = relation.where("(posts.id = ? or posts.parent_id = ?)", q[:parent_id], q[:parent_id])
has_constraints!
@@ -235,10 +245,10 @@ class PostQueryBuilder
when "favcount_asc"
relation = relation.order("posts.fav_count ASC, posts.id DESC")
when "comment"
when "comment", "comm"
relation = relation.order("posts.last_commented_at DESC, posts.id DESC").where("posts.last_commented_at is not null")
when "comment_asc"
when "comment_asc", "comm_asc"
relation = relation.order("posts.last_commented_at ASC, posts.id DESC").where("posts.last_commented_at is not null")
when "note"