Skip to content

Commit

Permalink
fixup! use localUrl for voice messages
Browse files Browse the repository at this point in the history
Signed-off-by: Maksim Sukharev <[email protected]>
  • Loading branch information
Antreesy committed Oct 23, 2024
1 parent cc7de63 commit 1157426
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
1 change: 0 additions & 1 deletion src/components/NewMessage/NewMessageAudioRecorder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ export default {
const fileName = this.generateFileName()
// Convert blob to file
const audioFile = new File([this.blob], fileName)
audioFile.localURL = window.URL.createObjectURL(this.blob)
this.$emit('audio-file', audioFile)
this.$emit('recording', false)
}
Expand Down
5 changes: 1 addition & 4 deletions src/components/NewMessage/NewMessageUploadEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,7 @@ export default {
},

voiceMessageLocalURL() {
if (!this.firstFile?.file?.localURL) {
return ''
}
return this.firstFile.file.localURL
return this.$store.getters.getLocalUrl(this.firstFile.temporaryMessage.referenceId)
},
},

Expand Down
12 changes: 5 additions & 7 deletions src/store/fileUploadStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,13 +240,11 @@ const actions = {
+ getFileExtension(file.name)
}

// Get localurl for some image previews
let localUrl
if (SHARED_ITEM.MEDIA_ALLOWED_PREVIEW.includes(file.type)) {
localUrl = URL.createObjectURL(file)
} else if (isVoiceMessage) {
localUrl = file.localURL
}
// Get localUrl for uploaded allowed image previews and voice messages
const localUrl = (SHARED_ITEM.MEDIA_ALLOWED_PREVIEW.includes(file.type) || isVoiceMessage)
? URL.createObjectURL(file)
: undefined

// Create a unique index for each file
const date = new Date()
const index = 'temp_' + date.getTime() + Math.random()
Expand Down

0 comments on commit 1157426

Please sign in to comment.