From c71bf456e3a71d6539f0ade58c9e0cf5342979c6 Mon Sep 17 00:00:00 2001 From: schlagmichdoch Date: Wed, 13 Sep 2023 17:44:49 +0200 Subject: [PATCH] fix "and 2 other files" div not cleared properly --- public/scripts/ui.js | 24 +++++++++++------------ public_included_ws_fallback/scripts/ui.js | 24 +++++++++++------------ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/public/scripts/ui.js b/public/scripts/ui.js index 0ab425f..69cc23a 100644 --- a/public/scripts/ui.js +++ b/public/scripts/ui.js @@ -695,20 +695,20 @@ class ReceiveDialog extends Dialog { } _parseFileData(displayName, connectionHash, files, imagesOnly, totalSize) { - if (files.length > 1) { - let fileOther; - if (files.length === 2) { - fileOther = imagesOnly - ? Localization.getTranslation("dialogs.file-other-description-image") - : Localization.getTranslation("dialogs.file-other-description-file"); - } else { - fileOther = imagesOnly - ? Localization.getTranslation("dialogs.file-other-description-image-plural", null, {count: files.length - 1}) - : Localization.getTranslation("dialogs.file-other-description-file-plural", null, {count: files.length - 1}); - } - this.$fileOther.innerText = fileOther; + let fileOther = ""; + + if (files.length === 2) { + fileOther = imagesOnly + ? Localization.getTranslation("dialogs.file-other-description-image") + : Localization.getTranslation("dialogs.file-other-description-file"); + } else if (files.length >= 2) { + fileOther = imagesOnly + ? Localization.getTranslation("dialogs.file-other-description-image-plural", null, {count: files.length - 1}) + : Localization.getTranslation("dialogs.file-other-description-file-plural", null, {count: files.length - 1}); } + this.$fileOther.innerText = fileOther; + const fileName = files[0].name; const fileNameSplit = fileName.split('.'); const fileExtension = '.' + fileNameSplit[fileNameSplit.length - 1]; diff --git a/public_included_ws_fallback/scripts/ui.js b/public_included_ws_fallback/scripts/ui.js index edba81e..c5eb462 100644 --- a/public_included_ws_fallback/scripts/ui.js +++ b/public_included_ws_fallback/scripts/ui.js @@ -696,20 +696,20 @@ class ReceiveDialog extends Dialog { } _parseFileData(displayName, connectionHash, files, imagesOnly, totalSize) { - if (files.length > 1) { - let fileOther; - if (files.length === 2) { - fileOther = imagesOnly - ? Localization.getTranslation("dialogs.file-other-description-image") - : Localization.getTranslation("dialogs.file-other-description-file"); - } else { - fileOther = imagesOnly - ? Localization.getTranslation("dialogs.file-other-description-image-plural", null, {count: files.length - 1}) - : Localization.getTranslation("dialogs.file-other-description-file-plural", null, {count: files.length - 1}); - } - this.$fileOther.innerText = fileOther; + let fileOther = ""; + + if (files.length === 2) { + fileOther = imagesOnly + ? Localization.getTranslation("dialogs.file-other-description-image") + : Localization.getTranslation("dialogs.file-other-description-file"); + } else if (files.length >= 2) { + fileOther = imagesOnly + ? Localization.getTranslation("dialogs.file-other-description-image-plural", null, {count: files.length - 1}) + : Localization.getTranslation("dialogs.file-other-description-file-plural", null, {count: files.length - 1}); } + this.$fileOther.innerText = fileOther; + const fileName = files[0].name; const fileNameSplit = fileName.split('.'); const fileExtension = '.' + fileNameSplit[fileNameSplit.length - 1];