Skip to content

Commit

Permalink
fix(imageUpload): fixes uploaded images being added to the wrong chat…
Browse files Browse the repository at this point in the history
… when changing during NSFW check (#1559)
  • Loading branch information
cmckelvy42 committed Feb 21, 2022
1 parent f9f1bed commit 6aeea21
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions components/views/files/upload/Upload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export default Vue.extend({
watch: {
recipient() {
this.files = cloneDeep(this.chat.files?.[this.recipient.address]) ?? []
this.$parent.$data.showFilePreview = this.files.length > 0
},
},
mounted() {
Expand Down Expand Up @@ -101,6 +102,7 @@ export default Vue.extend({
this.$data.count_error = true
return
}
const address = this.recipient.address
this.$data.count_error = false
for (let i = 0; i < files.length; i++) {
/* checking .heic file needs file array buffer because sometimes its file type return empty string */
Expand Down Expand Up @@ -145,6 +147,10 @@ export default Vue.extend({
}
uploadFile.nsfw.checking = false
}
this.$store.commit('chat/addFile', {
file: uploadFile,
address,
})
this.loadPicture(uploadFile)
})
this.files.push(...newFiles)
Expand All @@ -168,10 +174,6 @@ export default Vue.extend({
if (e.target) item.url = e.target.result
}
reader.readAsDataURL(item.file)
this.$store.commit('chat/addFile', {
file: item,
address: this.recipient.address,
})
},
/**
* @method cancelUpload
Expand Down

0 comments on commit 6aeea21

Please sign in to comment.