mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-24 16:58:47 +01:00
Move unsupported files alert to outside the loop
Co-authored-by: Lim Chee Aun <cheeaun@gmail.com>
This commit is contained in:
parent
53f7c39c77
commit
c277cbca8f
1 changed files with 10 additions and 2 deletions
|
@ -600,6 +600,7 @@ function Compose({
|
|||
const handleItems = (e) => {
|
||||
const { items } = e.clipboardData || e.dataTransfer;
|
||||
const files = [];
|
||||
const unsupportedFiles = [];
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
const item = items[i];
|
||||
if (item.kind === 'file') {
|
||||
|
@ -609,14 +610,21 @@ function Compose({
|
|||
return;
|
||||
}
|
||||
else if (supportedMimeTypes !== undefined && !supportedMimeTypes.includes(file.type)) {
|
||||
alert(t`File "${file.name}" is not supported by your instance.`);
|
||||
return;
|
||||
unsupportedFiles.push(file);
|
||||
}
|
||||
else {
|
||||
files.push(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (unsupportedFiles.length > 0) {
|
||||
alert(
|
||||
plural(unsupportedFiles.length, {
|
||||
one: `File ${unsupportedFiles[0]} is not supported by your instance.`,
|
||||
other: `Files ${unsupportedFiles.join(", ")} are not supported by your instance.`,
|
||||
}),
|
||||
);
|
||||
}
|
||||
if (files.length > 0 && mediaAttachments.length >= maxMediaAttachments) {
|
||||
alert(
|
||||
plural(maxMediaAttachments, {
|
||||
|
|
Loading…
Reference in a new issue