Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(upload): fix leftover errors/progress upload on recipient #3019

Merged
merged 1 commit into from
May 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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