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)
Thu, Apr 25, 1:06 AM
Unknown Object (File)
Mon, Apr 22, 1:04 AM
Unknown Object (File)
Sat, Apr 6, 8:30 AM
Unknown Object (File)
Sun, Mar 31, 6:16 PM
Unknown Object (File)
Sun, Mar 31, 8:23 AM
Unknown Object (File)
Sun, Mar 31, 8:23 AM
Unknown Object (File)
Sat, Mar 30, 4:09 AM
Unknown Object (File)
Thu, Mar 28, 11:23 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
Branch
T7685
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 5476
Build 5494: [Placeholder Plan] Wait for 30 Seconds

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
20–22

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
20–22

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.

94–108

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.