Skip to content

Commit

Permalink
fix(upload): fix leftover errors and in progress files upload on reci…
Browse files Browse the repository at this point in the history
…pient change
  • Loading branch information
vimercati-samir authored and stavares843 committed Apr 29, 2022
1 parent 9b4ad32 commit 711e2bf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion components/views/chat/chatbar/Chatbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/>
<div
class="chatbar-wrap"
:class="{'is-error': charlimit, 'inactive': !recipient, 'top-corners-sharp': files.length > 0 || ui.replyChatbarContent.id || commandPreview || $store.state.chat.alertNsfw}"
:class="{'is-error': charlimit, 'inactive': !recipient, 'top-corners-sharp': files.length > 0 || ui.replyChatbarContent.id || commandPreview || $store.state.chat.alertNsfw || $store.state.chat.countError}"
ref="wrap"
>
<div class="control-wrap file-upload-wrap">
Expand Down
13 changes: 11 additions & 2 deletions components/views/chat/chatbar/Chatbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ declare module 'vue/types/vue' {
clearChatbar: Function
handleChatBorderRadius: Function
files: UploadDropItemType[]
onRecipientChangeResetUploadState: Function
}
}
export default Vue.extend({
Expand Down Expand Up @@ -155,9 +156,9 @@ export default Vue.extend({
deep: true,
},
'recipient.address': {
handler() {
handler(value) {
const findItem = this.chat.chatTexts.find(
(item: any) => item.userId === this.$props.recipient?.address,
(item: any) => item.userId === value,
)
const message = findItem ? findItem.value : ''
this.$refs.editable?.resetHistory()
Expand All @@ -171,6 +172,8 @@ export default Vue.extend({
if (this.$device.isDesktop) {
this.$store.dispatch('ui/setChatbarFocus')
}
this.onRecipientChangeResetUploadState(value)
},
},
},
Expand Down Expand Up @@ -380,6 +383,12 @@ export default Vue.extend({
this.$store.commit('chat/setContainsNsfw', false)
this.$store.commit('chat/setCountError', false)
},
onRecipientChangeResetUploadState(recipient: string) {
this.$data.files = this.getFiles(recipient)
this.$store.commit('chat/setContainsNsfw', false)
this.$store.commit('chat/setCountError', false)
this.$store.commit('chat/setAlertNsfw', false)
},
beforeDestroy() {
this.unsubscribe()
},
Expand Down
2 changes: 1 addition & 1 deletion components/views/files/upload/filePreview/FilePreview.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<x-icon
size="1x"
class="has-text-danger"
@click="this.$emit('cancelUpload')"
@click="$emit('cancelUpload')"
/>
</div>
</div>
Expand Down

0 comments on commit 711e2bf

Please sign in to comment.