]> cat aescling's git repositories - mastodon.git/commitdiff
Fix bookmarks also searchable (#13293)
authorTakeshi Umeda <noel.yoshiba@gmail.com>
Sun, 22 Mar 2020 01:40:03 +0000 (10:40 +0900)
committerGitHub <noreply@github.com>
Sun, 22 Mar 2020 01:40:03 +0000 (02:40 +0100)
app/chewy/statuses_index.rb

index f5735421c7c90bccc616cacbbd89b312eeb4629c..bec9ed88b22b94f754e7e8356bc7c9ff811bca9a 100644 (file)
@@ -47,6 +47,11 @@ class StatusesIndex < Chewy::Index
       data.each.with_object({}) { |(id, name), result| (result[id] ||= []).push(name) }
     end
 
+    crutch :bookmarks do |collection|
+      data = ::Bookmark.where(status_id: collection.map(&:id)).where(account: Account.local).pluck(:status_id, :account_id)
+      data.each.with_object({}) { |(id, name), result| (result[id] ||= []).push(name) }
+    end
+
     root date_detection: false do
       field :id, type: 'long'
       field :account_id, type: 'long'