Page MenuHomePhabricator

Quicksand - make things work correctly with global drag and drop upload
ClosedPublic

Authored by btrahan on Apr 23 2015, 9:11 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Mar 22, 4:06 AM
Unknown Object (File)
Feb 10 2024, 4:27 PM
Unknown Object (File)
Feb 8 2024, 8:29 PM
Unknown Object (File)
Feb 3 2024, 3:29 AM
Unknown Object (File)
Feb 1 2024, 4:27 AM
Unknown Object (File)
Jan 17 2024, 4:00 AM
Unknown Object (File)
Jan 17 2024, 4:00 AM
Unknown Object (File)
Jan 17 2024, 4:00 AM
Subscribers
Tokens
"Grey Medal" token, awarded by epriestley.

Details

Summary

Fixes T7685. This required making the global drag and drop behavior able to "uninstall" itself so to speak, and then it re-installs it self as necessary.

Test Plan

Did the following all successfully

  • uploaded a file to homepage
  • homepage -> differential -- no way to upload via drag and drop
  • homepage -> differential -> homepage -- uploaded a file
  • homepage -> differential -> browser back button to homepage -- uploaded a file

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

btrahan retitled this revision from to Quicksand - make things work correctly with global drag and drop upload.
btrahan updated this object.
btrahan edited the test plan for this revision. (Show Details)
btrahan added a reviewer: epriestley.
webroot/rsrc/js/core/behavior-global-drag-and-drop.js
21–36

As far as I can tell, this doesn't actually do anything? The data only gets set on the file upload controller and the pertinent div is not hidden to begin with... Safe to kill or did this break or?

src/applications/files/view/PhabricatorGlobalUploadTargetView.php
33

I was getting errors on this being dynamic - differs per page - so I just figured making it a big long unique string would work.

epriestley edited edge metadata.
epriestley added inline comments.
webroot/rsrc/js/core/behavior-global-drag-and-drop.js
21–36

The div is initially hidden for me, at least -- this hides it on my system:

PhabricatorFileUploadController.php
40       ->setControlStyle('display: none')

That said, it would probably be fine to kill it; every reasonable browser supports this now.

102–116

Another approach would be to just make this do:

statics.drop.setEnabled(data.newResponse.globalDragAndDrop);

...and all the listeners in DragAndDropFileUpload just did something like:

if (!this.getEnabled()) {
  return;
}

I'm not sure if that would actually be any smaller in this case, but it usually seems to end up a bit cleaner than trying to uninstall/reinstall listeners.

This revision is now accepted and ready to land.Apr 23 2015, 9:24 PM
btrahan edited edge metadata.

Switch to a get/set IsEnabled version. Seems less perilous; sold!

clean up JS just a tad more

This revision was automatically updated to reflect the committed changes.