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

Drop-send multiple files➬ask for all files at once #1640

Merged
merged 1 commit into from
May 14, 2020

Conversation

Simon-Laux
Copy link
Member

fixes #1622
new-file-drop-dialog

@Simon-Laux Simon-Laux requested review from nicodh and Jikstra May 14, 2020 03:57
'Prevented a file from being send again while dragging it out',
name
)
}
Copy link
Contributor

@Jikstra Jikstra May 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for something like this functional patterns come in very handy.

Just some pseudo code

let fileList: FileList = (e.target as any).files || e.dataTransfer.files
const forbiddenPathRegEx = /DeltaChat\/.+?\.sqlite-blobs\//gi
const isForbidden = ({path, name}) => {
  if(forbiddenPathRegEx.test(path.replace('\\', '/'))) {
    log.warn('Prevented a file from being send again while dragging it out', name)
    return false
  }
  return true
}
const sanitizedFileList = fileList.filter(isForbidden)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nah, we can still change this later..
PS: I used a feature of let here, scoped usage. might have interesting usages.

@Jikstra
Copy link
Contributor

Jikstra commented May 14, 2020

I think functional patterns would be nicer but anyway this looks good.

@Simon-Laux Simon-Laux merged commit 6f16f55 into master May 14, 2020
@Simon-Laux Simon-Laux deleted the polish-drop-multiple-files_#1622 branch November 27, 2020 04:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Drop-send multiple files - ask for all files at once
2 participants