From eba1c84d7a8d8e4d66e4ca5474cfa2508b2319b4 Mon Sep 17 00:00:00 2001
From: 10G Meow <10gmeow@gmail.com>
Date: Sat, 12 Aug 2023 11:54:43 +0300
Subject: [PATCH] improve large file upload error message
---
src/assets/translations/en.json | 5 +-
src/components/Chat.vue | 124 +++++++++++++++++---------------
2 files changed, 71 insertions(+), 58 deletions(-)
diff --git a/src/assets/translations/en.json b/src/assets/translations/en.json
index fea61ac..40f5aee 100644
--- a/src/assets/translations/en.json
+++ b/src/assets/translations/en.json
@@ -66,8 +66,9 @@
"file_prefix": "File: ",
"edited": "(edited)",
"download_progress": "{percentage}% downloaded",
- "upload_file_too_large": "Maximum file size of ({configFormattedUploadSize}) exceeded. File is too large to upload!",
- "upload_exceeded_file_limit": "File: ({exceededFile}) ({formattedUploadSize}) exceeds maximum limit.",
+ "preparing_to_upload": "Preparing to upload...",
+ "upload_file_too_large": "File is too large to upload!",
+ "upload_exceeded_file_limit": "Maximum file size of ({configFormattedUploadSize}) exceeded. ",
"upload_progress": "Uploaded {count}",
"upload_progress_with_total": "Uploaded {count} of {total}",
"user_changed_room_history": "{user} made room history {type}",
diff --git a/src/components/Chat.vue b/src/components/Chat.vue
index c6bd3dd..e67d54e 100644
--- a/src/components/Chat.vue
+++ b/src/components/Chat.vue
@@ -205,61 +205,72 @@
- {{ $t('message.send_attachements_dialog_title') }}
-
-
- {{ $t('message.images') }}
-
-
-
-
-
-
-
-
- {{ currentImageInput.scaledDimensions.width }} x {{ currentImageInput.scaledDimensions.height }}
-
- {{ currentImageInput.dimensions.width }} x {{ currentImageInput.dimensions.height }}
-
-
-
- ({{ formatBytes(currentImageInput.scaledSize) }})
-
-
- ({{ formatBytes(currentImageInput.actualSize) }})
-
-
-
-
-
-
-
-
- {{ $t('message.files') }}
-
-
-
- {{ $t('message.file') }}: {{ currentImageInputPath.name }}
- ({{ formatBytes(currentImageInputPath.size) }})
-
-
-
-
-
-
-
-
- {{ currentSendError }}
+
+ {{ this.$t("message.preparing_to_upload")}}
+
+
+
+
{{ currentSendErrorExceededFile }}
-
-
- {{ $t("menu.cancel") }}
-
- {{ $t("menu.send") }}
-
+ {{ $t('message.send_attachements_dialog_title') }}
+
+
+
+ {{ $t('message.images') }}
+
+
+
+
+
+
+
+
+ {{ currentImageInput.scaledDimensions.width }} x {{ currentImageInput.scaledDimensions.height }}
+
+ {{ currentImageInput.dimensions.width }} x {{ currentImageInput.dimensions.height }}
+
+
+
+ ({{ formatBytes(currentImageInput.scaledSize) }})
+
+
+ ({{ formatBytes(currentImageInput.actualSize) }})
+
+
+
+
+
+
+
+
+ {{ $t('message.files') }}
+
+
+
+ {{ $t('message.file') }}: {{ currentImageInputPath.name }}
+ ({{ formatBytes(currentImageInputPath.size) }})
+
+
+
+
+
+
+
+
+ {{ currentSendError }}
+
+
+ {{ $t("menu.cancel") }}
+
+ {{ $t("menu.send") }}
+
+
@@ -1179,6 +1190,7 @@ export default {
* Handle picked attachment
*/
handlePickedAttachment(event) {
+ this.currentFileInputs = []
const uploadedFiles = Object.values(event.target.files);
this.$matrix.matrixClient.getMediaConfig().then((config) => {
@@ -1187,8 +1199,8 @@ export default {
uploadedFiles.every(file => {
if (configUploadSize && file.size > configUploadSize) {
- this.currentSendError = this.$t("message.upload_file_too_large", { configFormattedUploadSize });
- this.currentSendErrorExceededFile = this.$t("message.upload_exceeded_file_limit", { exceededFile: file.name, formattedUploadSize: this.formatBytes(file.size) });
+ this.currentSendError = this.$t("message.upload_file_too_large");
+ this.currentSendErrorExceededFile = this.$t("message.upload_exceeded_file_limit", { configFormattedUploadSize });
this.currentSendShowSendButton = false;
return false;
} else {