mirror of
https://github.com/immich-app/immich.git
synced 2026-02-12 11:58:15 +03:00
fixed the local ids selecting issue
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user