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:
Nariman Jelveh committed 2026-10-24 16:15:00 -07:00
1 parent b9565ef17a
commit e4c6d4ab5d
1 file changed
+12 -2
+12 -2
View File
@@ -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