0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-02-11 01:18:24 -05:00

fixed the local ids selecting issue

This commit is contained in:
Yashraj Jain 2024-10-07 23:24:03 +05:30
parent 94d213bbb9
commit 7085b19e91

View file

@ -204,11 +204,26 @@ class MultiselectGrid extends HookConsumerWidget {
void onDeleteLocal(bool onlyBackedUp) async {
processing.value = true;
try {
final localIds = selection.value.where((a) => a.isLocal).toList();
// Filter local assets based on the backup status (`isRemote`).
// If `onlyBackedUp` is true, only select assets that are also present on the server (`isRemote`).
final localIds = selection.value
.where((a) => a.isLocal && (!onlyBackedUp || a.isRemote))
.toList();
if (localIds.isEmpty) {
ImmichToast.show(
context: context,
msg: 'No backed-up assets selected for deletion.',
gravity: ToastGravity.BOTTOM,
);
return;
}
// Proceed with deletion of filtered assets
final isDeleted = await ref
.read(assetProvider.notifier)
.deleteLocalOnlyAssets(localIds, onlyBackedUp: onlyBackedUp);
if (isDeleted) {
ImmichToast.show(
context: context,