FEATURE: Add search to user bookmark list (#10230)

User bookmarks can now be searched by name or post raw content. The q querystring param is hooked up from the Ember router as well.
This commit is contained in:
Martin Brennan
2020-07-14 14:43:41 +10:00
committed by GitHub
parent f4f3e8c401
commit bcc80e0ea8
9 changed files with 78 additions and 8 deletions
+4
View File
@@ -35,6 +35,10 @@ class BookmarkQuery
results = results.merge(Post.secured(@guardian))
if @params[:q].present?
results = results.where("bookmarks.name ILIKE :q OR posts.raw ILIKE :q", q: "%#{@params[:q]}%")
end
if @page.positive?
results = results.offset(@page * @params[:per_page])
end