DEV: Changes to support chat uploads (#15153)

This commit is contained in:
Mark VanLandingham 2021-12-01 13:24:16 -06:00 committed by GitHub
parent abe30a17da
commit bd140948e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 4 deletions

View File

@ -120,7 +120,7 @@ export function validateUploadedFile(file, opts) {
return true; return true;
} }
const IMAGES_EXTENSIONS_REGEX = /(png|jpe?g|gif|svg|ico|heic|heif|webp)/i; export const IMAGES_EXTENSIONS_REGEX = /(png|jpe?g|gif|svg|ico|heic|heif|webp)/i;
function extensionsToArray(exts) { function extensionsToArray(exts) {
return exts return exts

View File

@ -273,6 +273,7 @@ export default Mixin.create(ExtendableUploader, UppyS3Multipart, {
fileName: file.name, fileName: file.name,
id: file.id, id: file.id,
progress: 0, progress: 0,
extension: file.extension,
}) })
); );
const placeholder = this._uploadPlaceholder(file); const placeholder = this._uploadPlaceholder(file);

View File

@ -39,9 +39,13 @@ module Jobs
next if ReviewableQueuedPost.pending.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? next if Draft.where("data LIKE '%#{upload.sha1}%' OR data LIKE '%#{encoded_sha}%'").exists?
next if UserProfile.where("bio_raw LIKE '%#{upload.sha1}%' OR bio_raw LIKE '%#{encoded_sha}%'").exists? next if UserProfile.where("bio_raw LIKE '%#{upload.sha1}%' OR bio_raw LIKE '%#{encoded_sha}%'").exists?
if defined?(ChatMessage) && if defined?(ChatMessage)
ChatMessage.where("message LIKE ? OR message LIKE ?", "%#{upload.sha1}%", "%#{encoded_sha}%").exists? # TODO after May 2022 - remove this. No longer needed as chat uploads are in a table
next next if ChatMessage.where("message LIKE ? OR message LIKE ?", "%#{upload.sha1}%", "%#{encoded_sha}%").exists?
end
if defined?(ChatUpload)
next if ChatUpload.where(upload: upload).exists?
end end
upload.destroy upload.destroy
else else