mirror of
https://github.com/HeyPuter/puter.git
synced 2026-11-05 13:35:20 +00:00
fix(dashboard): don't offer read-only shared folders as drop targets
Folders shared read-only lit up under a drag and took the drop, which the server then refused with "Forbidden". They no longer light up, and a drop on one sends the drag back where it began; they still open on a dwell.
This commit is contained in:
1 parent
b9565ef17a
commit
e4c6d4ab5d
1 file changed
+12
-2
@@ -4005,6 +4005,13 @@ const TabFiles = {
|
||||
// — quietly rename the dragged file to "New Folder".
|
||||
if ( isPending() ) return;
|
||||
|
||||
// A folder shared read-only takes nothing; the server
|
||||
// would refuse each item. The drag goes back instead.
|
||||
if ( _this.isReadOnlyShare($(el_item).attr('data-path')) ) {
|
||||
ui.helper.data('cancelled', true);
|
||||
return;
|
||||
}
|
||||
|
||||
const draggedPath = $(ui.draggable).attr('data-path');
|
||||
if ( event.ctrlKey && draggedPath?.startsWith(`${window.trash_path}/`) ) {
|
||||
return;
|
||||
@@ -4032,9 +4039,12 @@ const TabFiles = {
|
||||
// not exist yet (see the drop handler above).
|
||||
if ( isPending() ) return;
|
||||
|
||||
$(el_item).addClass('selected');
|
||||
|
||||
const _this = TabFiles;
|
||||
// Not a drop target, but it still opens on a dwell.
|
||||
if ( ! _this.isReadOnlyShare($(el_item).attr('data-path')) ) {
|
||||
$(el_item).addClass('selected');
|
||||
}
|
||||
|
||||
const targetPath = $(el_item).attr('data-path');
|
||||
|
||||
// Don't auto-open the current directory or trash
|
||||
|
||||
Reference in new issue
Block a user