Skip to content
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
18 changes: 16 additions & 2 deletions src/components/NewMessageForm/NewMessageForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ import Quote from '../Quote'
import Actions from '@nextcloud/vue/dist/Components/Actions'
import ActionButton from '@nextcloud/vue/dist/Components/ActionButton'
import EmojiPicker from '@nextcloud/vue/dist/Components/EmojiPicker'
import { EventBus } from '../../services/EventBus'
import { shareFile } from '../../services/filesSharingServices'
import { processFiles } from '../../utils/fileUpload'
import { CONVERSATION } from '../../constants'
Expand Down Expand Up @@ -173,9 +174,21 @@ export default {

mounted() {
this.isCurrentConversationIsFirstInList()

EventBus.$on('uploadStart', this.handleUploadStart)
},

beforeDestroy() {
EventBus.$off('uploadStart', this.handleUploadStart)
},

methods: {
handleUploadStart() {
// refocus on upload start as the user might want to type again
// while the upload is running
this.$refs.advancedInput.focusInput()
},

contentEditableToParsed(contentEditable) {
const mentions = contentEditable.querySelectorAll('span[data-at-embedded]')
mentions.forEach(mention => {
Expand Down Expand Up @@ -270,6 +283,7 @@ export default {
throw new Error(t('files', 'Invalid path selected'))
}
shareFile(path, this.token)
this.$refs.advancedInput.focusInput()
})
},

Expand All @@ -292,11 +306,11 @@ export default {
*
* @param {File[] | FileList} files pasted files list
*/
handleFiles(files) {
async handleFiles(files) {
// Create a unique id for the upload operation
const uploadId = new Date().getTime()
// Uploads and shares the files
processFiles(files, this.token, uploadId)
await processFiles(files, this.token, uploadId)
},

/**
Expand Down
2 changes: 2 additions & 0 deletions src/store/fileUploadStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ const actions = {
* @param {object} uploadId The unique uploadId
*/
async uploadFiles({ commit, dispatch, state, getters }, uploadId) {
EventBus.$emit('uploadStart')

// Tag the previously indexed files and add the temporary messages to the
// messages list
Expand Down Expand Up @@ -266,6 +267,7 @@ const actions = {
}
}
}
EventBus.$emit('uploadFinished')
},
/**
* Set the folder to store new attachments in
Expand Down