Skip to content

Commit

Permalink
Merge pull request #4539 from nextcloud/bugfix/noid/preview-rename-on…
Browse files Browse the repository at this point in the history
…ly-on-paste

Only autorename uploads on paste
  • Loading branch information
PVince81 authored Nov 6, 2020
2 parents 5ab59a6 + 6a92e53 commit a740b4e
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/components/NewMessageForm/NewMessageForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
:placeholder-text="placeholderText"
@update:contentEditable="contentEditableToParsed"
@submit="handleSubmit"
@files-pasted="handleFiles" />
@files-pasted="handlePastedFiles" />
</div>
<button
:disabled="isReadOnly"
Expand Down Expand Up @@ -329,15 +329,25 @@ export default {
},

/**
* Handles files pasting event.
* Handles files pasting event
*
* @param {File[] | FileList} files pasted files list
*/
async handleFiles(files) {
async handlePastedFiles(files) {
this.handleFiles(files, true)
},

/**
* Handles file upload
*
* @param {File[] | FileList} files pasted files list
* @param {bool} rename whether to rename the files
*/
async handleFiles(files, rename = false) {
// Create a unique id for the upload operation
const uploadId = new Date().getTime()
// Uploads and shares the files
await processFiles(files, this.token, uploadId, true)
await processFiles(files, this.token, uploadId, rename)
},

/**
Expand Down

0 comments on commit a740b4e

Please sign in to comment.