Add reason argument to removeFiles

This commit is contained in:
Artur Paikin 2020-06-24 18:27:19 +01:00
parent 945b7b92fb
commit eab4ddd55c
2 changed files with 6 additions and 6 deletions

View file

@ -711,7 +711,7 @@ class Uppy {
}
}
removeFiles (fileIDs) {
removeFiles (fileIDs, reason) {
const { files, currentUploads } = this.getState()
const updatedFiles = { ...files }
const updatedUploads = { ...currentUploads }
@ -764,7 +764,7 @@ class Uppy {
const removedFileIDs = Object.keys(removedFiles)
removedFileIDs.forEach((fileID) => {
this.emit('file-removed', removedFiles[fileID])
this.emit('file-removed', removedFiles[fileID], reason)
})
if (removedFileIDs.length > 5) {
@ -774,8 +774,8 @@ class Uppy {
}
}
removeFile (fileID) {
this.removeFiles([fileID])
removeFile (fileID, reason = null) {
this.removeFiles([fileID], reason)
}
pauseResume (fileID) {
@ -866,7 +866,7 @@ class Uppy {
const fileIDs = Object.keys(files)
if (fileIDs.length) {
this.removeFiles(fileIDs)
this.removeFiles(fileIDs, 'cancel-all')
}
this.setState({

View file

@ -112,7 +112,7 @@ module.exports = function Buttons (props) {
i18n={i18n}
info={props.info}
log={props.log}
onClick={() => removeFile(file.id)}
onClick={() => removeFile(file.id, 'removed-by-user')}
/>
) : null}
</div>