File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,19 +26,19 @@ class StatusesIndex < Chewy::Index
2626 } ,
2727 }
2828
29- define_type ::Status . unscoped . kept . without_reblogs . includes ( :media_attachments ) , delete_if : -> ( status ) { status . searchable_by . empty? } do
29+ define_type ::Status . unscoped . without_reblogs . includes ( :media_attachments ) do
3030 crutch :mentions do |collection |
31- data = ::Mention . where ( status_id : collection . map ( &:id ) ) . where ( account : Account . local ) . pluck ( :status_id , :account_id )
31+ data = ::Mention . where ( status_id : collection . map ( &:id ) ) . pluck ( :status_id , :account_id )
3232 data . each . with_object ( { } ) { |( id , name ) , result | ( result [ id ] ||= [ ] ) . push ( name ) }
3333 end
3434
3535 crutch :favourites do |collection |
36- data = ::Favourite . where ( status_id : collection . map ( &:id ) ) . where ( account : Account . local ) . pluck ( :status_id , :account_id )
36+ data = ::Favourite . where ( status_id : collection . map ( &:id ) ) . pluck ( :status_id , :account_id )
3737 data . each . with_object ( { } ) { |( id , name ) , result | ( result [ id ] ||= [ ] ) . push ( name ) }
3838 end
3939
4040 crutch :reblogs do |collection |
41- data = ::Status . where ( reblog_of_id : collection . map ( &:id ) ) . where ( account : Account . local ) . pluck ( :reblog_of_id , :account_id )
41+ data = ::Status . where ( reblog_of_id : collection . map ( &:id ) ) . pluck ( :reblog_of_id , :account_id )
4242 data . each . with_object ( { } ) { |( id , name ) , result | ( result [ id ] ||= [ ] ) . push ( name ) }
4343 end
4444
Original file line number Diff line number Diff line change @@ -132,14 +132,12 @@ class Status < ApplicationRecord
132132 REAL_TIME_WINDOW = 6 . hours
133133
134134 def searchable_by ( preloaded = nil )
135- ids = [ ]
136-
137- ids << account_id if local?
135+ ids = [ account_id ]
138136
139137 if preloaded . nil?
140- ids += mentions . where ( account : Account . local ) . pluck ( :account_id )
141- ids += favourites . where ( account : Account . local ) . pluck ( :account_id )
142- ids += reblogs . where ( account : Account . local ) . pluck ( :account_id )
138+ ids += mentions . pluck ( :account_id )
139+ ids += favourites . pluck ( :account_id )
140+ ids += reblogs . pluck ( :account_id )
143141 else
144142 ids += preloaded . mentions [ id ] || [ ]
145143 ids += preloaded . favourites [ id ] || [ ]
You can’t perform that action at this time.
0 commit comments