DEV: Changes to support chat uploads (#15153)
This commit is contained in:
parent
abe30a17da
commit
bd140948e3
|
@ -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
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue