Post.pending_or_flagged: fix ambiguous column reference.
Fixes an ambiguous column reference error when searching for
`status:unmoderated` on the comments page:
https://danbooru.donmai.us/comments?group_by=comment&search[post_tags_match]=status:unmoderated
Also removes the `id in (...)` subquery checking whether flagged posts
have a flag from the last week; this is always true.
This commit is contained in:
@@ -1618,15 +1618,15 @@ class Post < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def pending
|
def pending
|
||||||
where("is_pending = ?", true)
|
where(is_pending: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
def flagged
|
def flagged
|
||||||
where("is_flagged = ?", true)
|
where(is_flagged: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
def pending_or_flagged
|
def pending_or_flagged
|
||||||
where("(is_pending = ? or (is_flagged = ? and id in (select _.post_id from post_flags _ where _.created_at >= ?)))", true, true, 1.week.ago)
|
pending.or(flagged)
|
||||||
end
|
end
|
||||||
|
|
||||||
def undeleted
|
def undeleted
|
||||||
|
|||||||
Reference in New Issue
Block a user