FIX: Only consider pending queued posts for cleaning up uploads

This commit is contained in:
Robin Ward 2019-04-12 14:39:32 -04:00
parent 534d75310f
commit f7ebfb1acc
1 changed files with 1 additions and 1 deletions

View File

@ -76,7 +76,7 @@ module Jobs
result.find_each do |upload|
if upload.sha1.present?
encoded_sha = Base62.encode(upload.sha1.hex)
next if ReviewableQueuedPost.where("payload->>'raw' LIKE '%#{upload.sha1}%' OR payload->>'raw' LIKE '%#{encoded_sha}%'").exists?
next if ReviewableQueuedPost.pending.where("payload->>'raw' LIKE '%#{upload.sha1}%' OR payload->>'raw' LIKE '%#{encoded_sha}%'").exists?
next if Draft.where("data LIKE '%#{upload.sha1}%' OR data LIKE '%#{encoded_sha}%'").exists?
upload.destroy
else