mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-03-14 12:18:30 +03:00
Move unattachable files outside of the loop
This commit is contained in:
parent
28f87e2c8a
commit
e77219cff3
1 changed files with 10 additions and 2 deletions
|
@ -600,14 +600,14 @@ function Compose({
|
|||
const handleItems = (e) => {
|
||||
const { items } = e.clipboardData || e.dataTransfer;
|
||||
const files = [];
|
||||
const unattachableFiles = [];
|
||||
const unsupportedFiles = [];
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
const item = items[i];
|
||||
if (item.kind === 'file') {
|
||||
const file = item.getAsFile();
|
||||
if (!file) {
|
||||
alert(t`Unable to attach file.`);
|
||||
return;
|
||||
unattachableFiles.push(file);
|
||||
}
|
||||
else if (supportedMimeTypes !== undefined && !supportedMimeTypes.includes(file.type)) {
|
||||
unsupportedFiles.push(file);
|
||||
|
@ -617,6 +617,14 @@ function Compose({
|
|||
}
|
||||
}
|
||||
}
|
||||
if (unattachableFiles.length > 0) {
|
||||
alert(
|
||||
plural(unattachableFiles.length, {
|
||||
one: `Couldn't attach file ${unsupportedFiles[0]}.`,
|
||||
other: `Couldn't attach files ${unsupportedFiles.join(", ")}.`,
|
||||
})
|
||||
)
|
||||
}
|
||||
if (unsupportedFiles.length > 0) {
|
||||
alert(
|
||||
plural(unsupportedFiles.length, {
|
||||
|
|
Loading…
Add table
Reference in a new issue