FIX: Don't try and reindex posts that have been trashed.
This commit is contained in:
parent
b7d8bbc095
commit
c4997ce85f
|
@ -95,9 +95,8 @@ module Jobs
|
|||
ON pd.locale = :locale
|
||||
AND pd.version = :version
|
||||
AND pd.post_id = posts.id
|
||||
LEFT JOIN topics ON topics.id = posts.topic_id
|
||||
INNER JOIN topics ON topics.id = posts.topic_id
|
||||
WHERE pd.post_id IS NULL
|
||||
AND topics.id IS NOT NULL
|
||||
AND topics.deleted_at IS NULL
|
||||
AND posts.raw != ''
|
||||
ORDER BY posts.id DESC
|
||||
|
|
|
@ -49,12 +49,16 @@ describe Jobs::ReindexSearch do
|
|||
FakeIndexer.reset
|
||||
end
|
||||
|
||||
it 'should not reinex posts that belong to a deleted topic' do
|
||||
it (
|
||||
'should not reindex posts that belong to a deleted topic ' \
|
||||
'or have been trashed'
|
||||
) do
|
||||
post = Fabricate(:post)
|
||||
post2 = Fabricate(:post)
|
||||
post.post_search_data.destroy!
|
||||
post2.post_search_data.destroy!
|
||||
post3 = Fabricate(:post)
|
||||
PostSearchData.delete_all
|
||||
post2.topic.trash!
|
||||
post3.trash!
|
||||
|
||||
subject.rebuild_problem_posts(indexer: FakeIndexer)
|
||||
|
||||
|
|
Loading…
Reference in New Issue