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

Warn user before closing when uploading a file on a upload only link #16984

Merged
merged 1 commit into from
Sep 6, 2019

Conversation

juliusknorr
Copy link
Member

Make sure the browser shows a warning that a upload is still ongoing when uploading files though a drop only link.

Signed-off-by: Julius Härtl <jus@bitgrid.net>
Copy link
Member

@skjnldsv skjnldsv left a comment

Choose a reason for hiding this comment

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

Code looks good! :)

Copy link
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

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

Looks good!

@@ -120,6 +130,9 @@
e.preventDefault();
$('#public-upload #emptycontent input').focus().trigger('click');
});
window.onbeforeunload = function() {
Copy link
Member

Choose a reason for hiding this comment

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

From https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload#Syntax

Typically, it is better to use window.addEventListener() and the beforeunload event, instead of onbeforeunload.

Copy link
Member

Choose a reason for hiding this comment

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

Ah yes! Especially since we remove inline scripts with csp :)

Copy link
Member

Choose a reason for hiding this comment

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

So merge or?

Copy link
Member

Choose a reason for hiding this comment

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

Dunno. @juliushaertl which one should we use? :)

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't have a strong oppinion, this code is mainly a copy of what we use here:

window.onbeforeunload = function() {

So I'd say lets get it in and we can cleanup if we might refactor at some point, as I don't see any downside of that code for now

@rullzer rullzer mentioned this pull request Sep 4, 2019
16 tasks
@rullzer rullzer modified the milestones: Nextcloud 17, Nextcloud 18 Sep 5, 2019
@rullzer rullzer merged commit 803c8dd into master Sep 6, 2019
@rullzer rullzer deleted the bugfix/noid/warn-during-upload-drop branch September 6, 2019 10:18
@rullzer
Copy link
Member

rullzer commented Sep 6, 2019

Backport to 17?

@juliusknorr
Copy link
Member Author

Yes, I'd say so.

@juliusknorr
Copy link
Member Author

/backport to stable17

@backportbot-nextcloud
Copy link

backport to stable17 in #17034

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants