Skip to content

Commit c6df431

Browse files
authored
[ENG-9544] Fix drag and drop file moves (#787)
* fix(files): Fix drag and drop file moves * fix(files): Fix duplicate items when shift-clicking files * chore(files): Remove comment
1 parent 95c28d8 commit c6df431

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

src/app/features/files/components/confirm-move-file-dialog/confirm-move-file-dialog.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export class ConfirmMoveFileDialogComponent {
7474
files.forEach((file) => {
7575
const link = file.links.move;
7676
this.filesService
77-
.moveFile(link, path, this.fileProjectId, this.provider(), action)
77+
.moveFile(link, path, this.fileProjectId, this.provider, action)
7878
.pipe(
7979
takeUntilDestroyed(this.destroyRef),
8080
catchError((error) => {
@@ -116,7 +116,7 @@ export class ConfirmMoveFileDialogComponent {
116116
acceptLabelKey: 'common.buttons.replace',
117117
onConfirm: () => {
118118
const replaceRequests$ = conflictFiles.map(({ link }) =>
119-
this.filesService.moveFile(link, path, this.fileProjectId, this.provider(), action, true).pipe(
119+
this.filesService.moveFile(link, path, this.fileProjectId, this.provider, action, true).pipe(
120120
takeUntilDestroyed(this.destroyRef),
121121
catchError(() => of(null))
122122
)

src/app/features/files/pages/files/files.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@
150150
(setCurrentFolder)="setCurrentFolder($event)"
151151
(setMoveDialogCurrentFolder)="setMoveDialogCurrentFolder($event)"
152152
(updateFoldersStack)="onUpdateFoldersStack($event)"
153-
(resetFilesProvider)="resetProvider()"
153+
(resetFilesProvider)="resetOnDialogClose()"
154154
>
155155
</osf-files-tree>
156156
</div>

src/app/features/files/pages/files/files.component.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,8 @@ export class FilesComponent {
445445
}
446446

447447
onFileTreeSelected(file: FileModel): void {
448-
this.filesSelection = [...this.filesSelection, file];
448+
this.filesSelection.push(file);
449+
this.filesSelection = [...new Set(this.filesSelection)];
449450
}
450451

451452
onFileTreeUnselected(file: FileModel): void {
@@ -542,6 +543,12 @@ export class FilesComponent {
542543
}
543544
}
544545

546+
resetOnDialogClose(): void {
547+
this.onClearSelection();
548+
this.resetProvider();
549+
this.updateFilesList();
550+
}
551+
545552
createFolder(): void {
546553
const currentFolder = this.currentFolder();
547554
const newFolderLink = currentFolder?.links.newFolder;

0 commit comments

Comments
 (0)