From f4cca4af75aa724d49b6b45090905cdff26a8e56 Mon Sep 17 00:00:00 2001 From: Mark VanLandingham Date: Tue, 7 Sep 2021 13:33:48 -0500 Subject: [PATCH] DEV: Do not clean up chat message uploads (#14267) --- app/jobs/scheduled/clean_up_uploads.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/jobs/scheduled/clean_up_uploads.rb b/app/jobs/scheduled/clean_up_uploads.rb index 77f65031295..a3d9f1e55e7 100644 --- a/app/jobs/scheduled/clean_up_uploads.rb +++ b/app/jobs/scheduled/clean_up_uploads.rb @@ -39,6 +39,10 @@ module Jobs 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? next if ThemeSetting.where(data_type: ThemeSetting.types[:upload]).where("value LIKE ?", "%#{upload.sha1}%").exists? + if defined?(ChatMessage) && + ChatMessage.where("message LIKE ? OR message LIKE ?", "%#{upload.sha1}%", "%#{encoded_sha}%").exists? + next + end upload.destroy else upload.delete