diff --git a/app/javascript/dashboard/components/widgets/AttachmentsPreview.vue b/app/javascript/dashboard/components/widgets/AttachmentsPreview.vue
index 7403b80bd..46d928406 100644
--- a/app/javascript/dashboard/components/widgets/AttachmentsPreview.vue
+++ b/app/javascript/dashboard/components/widgets/AttachmentsPreview.vue
@@ -98,12 +98,7 @@ const fileName = file => {
- {{
- item.isRecordedAudio
- ? fileName(item.attachment.resource) ||
- $t('CONVERSATION.REPLYBOX.AUDIO_RECORDING')
- : fileName(item.attachment.resource)
- }}
+ {{ fileName(item.attachment.resource) }}
diff --git a/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue b/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue
index 98ca4a178..f141467d9 100644
--- a/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue
+++ b/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue
@@ -454,6 +454,10 @@ export default {
// Autosave the current message draft.
this.doAutoSaveDraft();
},
+ replyType(updatedReplyType, oldReplyType) {
+ this.setToDraft(this.conversationIdByRoute, oldReplyType);
+ this.getFromDraft();
+ },
},
mounted() {
@@ -572,6 +576,14 @@ export default {
if (this.hasRecordedAudio && this.attachedFiles.length) {
const audioFile = this.attachedFiles.find(file => file.isRecordedAudio);
if (audioFile) {
+ // Check if the audio file size exceeds the 5MB limit for localStorage
+ // If it does, show an error message and do not save
+ if (audioFile.resource.file.size > 5 * 1024 * 1024) {
+ useAlert(
+ this.$t('CONVERSATION.REPLYBOX.DRAFT_AUDIO_SIZE_LIMIT_ERROR')
+ );
+ return;
+ }
saveAudioToDraft(oldConversationId, this.replyType, audioFile);
}
}
@@ -600,7 +612,6 @@ export default {
// ensure that the message has signature set based on the ui setting
this.message = this.toggleSignatureForDraft(messageFromStore);
// get audio recording from draft
-
this.getAudioRecordingFromDraft(this.conversationIdByRoute);
}
},
diff --git a/app/javascript/dashboard/helpers/audioDraftHelper.js b/app/javascript/dashboard/helpers/audioDraftHelper.js
index 1c782f2b6..fed822ab0 100644
--- a/app/javascript/dashboard/helpers/audioDraftHelper.js
+++ b/app/javascript/dashboard/helpers/audioDraftHelper.js
@@ -63,6 +63,11 @@ export const saveAudioToDraft = async (
if (!audioFile?.resource?.file) {
return;
}
+ // Check if the audio file size exceeds the 5MB limit for localStorage
+ // If it does, show an error message and do not save
+ if (audioFile.resource.file.size > 5 * 1024 * 1024) {
+ return;
+ }
const key = getAudioStorageKey(conversationId, replyType);
diff --git a/app/javascript/dashboard/i18n/locale/en/conversation.json b/app/javascript/dashboard/i18n/locale/en/conversation.json
index db067b695..60caac392 100644
--- a/app/javascript/dashboard/i18n/locale/en/conversation.json
+++ b/app/javascript/dashboard/i18n/locale/en/conversation.json
@@ -196,7 +196,7 @@
"CANCEL": "Cancel"
}
},
- "AUDIO_RECORDING": "Recorded Audio"
+ "DRAFT_AUDIO_SIZE_LIMIT_ERROR": "Audio recording exceeds the 5MB size limit and cannot be saved as a draft"
},
"VISIBLE_TO_AGENTS": "Private Note: Only visible to you and your team",
"CHANGE_STATUS": "Conversation status changed",