chore: Clean up

This commit is contained in:
iamsivin
2025-03-25 23:59:11 +05:30
parent f46d7e581f
commit 4be4def0a6
4 changed files with 19 additions and 8 deletions
@@ -98,12 +98,7 @@ const fileName = file => {
<span
class="h-4 overflow-hidden text-sm font-medium text-ellipsis whitespace-nowrap"
>
{{
item.isRecordedAudio
? fileName(item.attachment.resource) ||
$t('CONVERSATION.REPLYBOX.AUDIO_RECORDING')
: fileName(item.attachment.resource)
}}
{{ fileName(item.attachment.resource) }}
</span>
</div>
<div class="w-[30%] justify-center">
@@ -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);
}
},
@@ -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);
@@ -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",