#335 fixed replacing entries during move/copy

This commit is contained in:
Thibault Deckers 2022-09-15 23:03:30 +02:00
parent 3090439e19
commit 7c84f1a4a4
2 changed files with 11 additions and 0 deletions

View file

@ -21,6 +21,7 @@ All notable changes to this project will be documented in this file.
- opening viewer with directory context in some cases
- photo frame widget rendering in some cases
- exporting large images to BMP
- replacing entries during move/copy
## <a id="v1.6.13"></a>[v1.6.13] - 2022-08-29

View file

@ -283,6 +283,16 @@ abstract class CollectionSource with SourceBase, AlbumMixin, LocationMixin, TagM
}) async {
if (movedOps.isEmpty) return;
final replacedUris = movedOps
.map((movedOp) => movedOp.newFields['path'] as String?)
.map((targetPath) {
final existingEntry = _rawEntries.firstWhereOrNull((entry) => entry.path == targetPath && !entry.trashed);
return existingEntry?.uri;
})
.whereNotNull()
.toSet();
await removeEntries(replacedUris, includeTrash: false);
final fromAlbums = <String?>{};
final movedEntries = <AvesEntry>{};
final copy = moveType == MoveType.copy;